We are trying to build two jars from the same pom file (and yes, I have read this Sonotype blog post saying not to) because we need one with all our resources and one without for internal political reasons. We have configured the maven-jar-plugin with a configuration that we think should work, but the resources are always included. Here is the relevant part of our pom file:
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>package-consumer</id>
<phase>package</phase>
<configuration>
<classifier>consumer</classifier>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.bmp</exclude>
<exclude>**/*.jpg</exclude>
<exclude>**/*.jpeg</exclude>
<exclude>**/*.gif</exclude>
<exclude>**/*.xml</exclude>
<exclude>**/*.sql</exclude>
<exclude>**/*.log4j</exclude>
<exclude>**/*.properties</exclude>
<exclude>**/*.sh</exclude>
</excludes>
</resource>
</resources>
</configuration>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
When we build, we get OurProject.Jar and OurProject-consumer.jar as one would expect, but all the same resources are in each jar file.
We have tried <exclude>**/*</exclude>
and <exclude>**/resources/*.*</exclude>
instead of the list or specific extensions. No joy. I am hoping that we are missing something basic.