I am trying to filter the resources included in my jar. I'm using shade-maven-plugin and this one is adding all the resources of all my dependencies into my generated jar, I only want to be included my project resources.
Here is my pom definition:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>es.app.applet.MyApplet</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>
I tried to add the next filter to remove all the resources, and then add another filter adding only my artifactID resources, but it doesn't work.
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>resources/*.*</exclude>
</excludes>
</filter> <filter>
<artifact>my.groupId:my.artifactId</artifact>
<includes>
<include>resources/*.*</include>
</includes>
</filter>
Ideas?
Thanks.
This is because filter includes happen before filter excludes.
With your code you are including you "my.groupId:my.artifactId" -> resources/.
But aterwards you are excluding all "resources/."
From the original documentation :
From a logical perspective, includes are processed before excludes, thus it's possible to use an include to collect a set of files from the archive then use excludes to further reduce the set.
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