I tried this to exclude whole directory (${basedir}/src/main/webapp/webscripts) from my WAR file but it failed. What is wrong?
this doesn't work:
<configuration> <webResources> <resource> <directory>${basedir}/src/main/webapp/webscripts</directory> <excludes> <exclude>**/*.*</exclude> </excludes> </resource> </webResources> </configuration>
this too:
<configuration> <webResources> <resource> <directory>${basedir}/src/main/webapp</directory> <excludes> <exclude>**/webscripts</exclude> </excludes> </resource> </webResources> </configuration>
Can anybody help?
maven-war-exclude-directory.mdpackagingExcludes configuration tag can be used to exclude certain files or directories from the war file. It is important to put '/' character at the end of the directory to be excluded. If there is no such '/' character, then the entry is interpreted as a regular file.
It is possible to include or exclude certain files from the WAR file, by using the <packagingIncludes> and <packagingExcludes> configuration parameters.
packagingExcludes: The comma separated list of tokens to exclude from the WAR before packaging. With packagingExcludes, the tokens are completely excluded from the final war file. With warSourceExcludes, the tokens are just ignored when copying the war directory into the war file.
Both of your solutions wouldn't help, as they would add an additional resource that is then deactivated. The webapp source folder is copied by default, without the resource mechanism.
The mechanism to deactivate a part of that is through the <warSourceExcludes>
parameter, like this:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1</version> <configuration> <warSourceExcludes>webscripts/**</warSourceExcludes> </configuration> </plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With