I have a section in pom.xml
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
</excludes>
</filter>
</filters>
I want to exclude *.SF and *.DSA files from final jar. But I get the following message:
[INFO] No artifact matching filter *:*
and files are not excluded. Does anyone know how to overcome it?
Shading is a process where a dependency is relocated to a different Java package and copied into the same JAR file as the code that relies on that dependency. The main purpose of shading is to avoid conflicts between the versions of dependencies used by a library and the versions used by the consumers of that library.
The dependency-reduced-pom. xml removes transitive dependencies which are already in your shaded jar. This prevents consumers from pulling them in twice.
This plugin provides the capability to package the artifact in an uber-jar, including its dependencies and to shade - i.e. rename - the packages of some of the dependencies.
Actually you can do global filtering without needing to specify group id, you just need to use the correct wildcard syntax. If you want to exclude all *.RSA files from your jar, for example, specify the artifactId as *:*:*:*
<filters>
<filter>
<artifact>*:*:*:*</artifact>
<excludes>
<exclude>*.RSA</exclude>
</excludes>
</filter>
</filters>
I had the same problem. It was fixed by making my artifact selector more specific, e.g.
<artifact>bouncycastle:*</artifact>
The entire block looks like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.mycompany.MainClass</mainClass>
</transformer>
</transformers>
<filters>
<filter>
<artifact>bouncycastle:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>standalone</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
<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