Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8300839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:42:13+00:00 2026-06-08T16:42:13+00:00

I’m using Maven 3 to package a WAR file, and I cannot figure out

  • 0

I’m using Maven 3 to package a WAR file, and I cannot figure out how to exclude files in src/main/webapp from the final WAR generated. One of the directories in src/main/webapp is a git submodule, and I want to exclude files like README, docs/, etc. in that git submodule form going to my final WAR.

My initial attempt was to use the maven-antrun-plugin to delete the files. I tried the delete actions in prepare-package and package, but neither worked. Doing the deletes in package removed the files from my target/<projname>/..., but the final WAR still contains the files. Running maven with -debug shows that the files are deleted after the WAR file is generated. It’s almost as if I want to do the deletes in between prepare-package and package.

My next attempts were to try to specify files to exclude from the WAR (some solutions linked below), but nothing seems to work. I might not be specifying the path to the unwanted files correctly, and I’m wondering if it has to do with the fact that my unwanted files are not in src/main/resources, but in src/main/webapp.

I’ve tried many solutions, but nothing seems to work. Each time I try something new, I do mvn clean and delete the target directory. The final generated WAR file always contains the unwanted files.

I feel like the answer to my problem exists on the SO and google searches I’ve come across, but nothing I’ve tried has worked exactly as I need. Below are some solutions I’ve tried.

  • exclude file from maven build
  • In Maven how to exclude resources from the generated jar?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T16:42:14+00:00Added an answer on June 8, 2026 at 4:42 pm

    since the files are inside the webapp folder I would guess the maven-war-plugin is the best point to start. the resource filtering with excludes points to src/main/resources and is not aware of the webapp folder.

    So http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html

    There is a parameter: warSourceExcludes: http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#warSourceExcludes

    this should allow filtering the README files and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.