maven2: excluding directory from WAR
Solution 1:
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>
Solution 2:
warSourceExcludes seems not to have been just renamed packagingExcludes.
warSourceExcludes: The comma separated list of tokens to exclude when copying the content of the warSourceDirectory.
packagingExcludes: The comma separated list of tokens to exclude from the WAR before packaging. This option may be used to implement the skinny WAR use case.
There is a big difference: 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. As a result, if the tokens are present in the webappDirectory for example, they will not be ignored when using warSourceExcludes but will be when using packagingExcludes.
And a working syntax example:
<warSourceExcludes>**/${project.artifactId}/**</warSourceExcludes>
Solution 3:
In version 2.1-alpha-1, this was incorrectly named warSourceExcludes. The right parameter is packagingExcludes
Example of usage (excludes WEB-INF/statics/ folder from WAR):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<warName>searchservice-web</warName>
<packagingExcludes>WEB-INF/statics/</packagingExcludes>
</configuration>
</plugin>
Solution 4:
Inorder to remove the source files i have used the below configuration in maven
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<packagingExcludes>
eb-app/app/**,eb-app/node_modules/**,eb-app/public/**,eb-app/server/**,eb-app/tests/**,eb-app/tmp/**,eb-app/vendor/**,eb-app/*
</packagingExcludes>
</configuration>
</plugin>