How can I filter certain classes in /target/classes from going into /target/[webapp]/WEB-INF/classes? I want them compiled into /target/classes/ but not in the final war.
Hello,
You can use the TrueZIP Maven Plugin ( http://mojo.codehaus.org/truezip-maven-plugin/ ).
See examples in:
http://svn.codehaus.org/mojo/trunk/mojo/truezip-maven-plugin/src/it/
What are these classes for? If they are for testing, you can specify them in src/test/java, they will then be compiled into target/test-classes in the test-compile phase, but won't be included in the final war.
If they aren't for testing and aren't to be included in the war, perhaps they should be refactored into another project so you can specify it as a dependency (perhaps with "provided" scope so they won't be deployed.
For reference you can configure the war to include and exclude resources when packaging.
The following example will include all jpgs but exclude resources from the image2 sub folder:
<configuration>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>resource2</directory>
<!-- the list has a default value of ** -->
<includes>
<include>**/*.jpg</include>
<includes>
<excludes>
<exclude>**/image2</exclude>
</excludes>
</resource>
</webResources>
</configuration>
See the war plugin documentation for more details.
You might have luck with this, assuming you them in a package that you can define with an ant pattern
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<excludes>**/dontneed/*.class</excludes>
</configuration>
</plugin>