Reputation: 340
I use the maven-shade-plugin to relocate a dependency in order to avoid classpath conflicts in my project. It all works well when running "mvn install", but when I run "mvn install" TWO times, it will fail the second time. I get errors like:
Error creating shaded jar: duplicate entry: META-INF/...
This is due to the having this transformer:
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
Not sure why it fails. It could be a bug. Anyway, I can't run the plugin twice without cleaning up in-between.
Now the greater problem is that during our CI build, we run "mvn package verify". This causes the Shade plugin to run twice in the build. And of course, the second time it fails.
I've looked at the effective pom and didn't see anything unusual. The plugin is not repeated twice.
Is there some way I could perhaps exclude the plugin from running during the verify phase?
Upvotes: 1
Views: 2313
Reputation: 340
I solved the issue. Looks like the maven-source-plugin was interfering with the shade plugin. I was using the source plugin to provide the source code of the relocated packages. The goal "aggregate" was somehow causing the build to fail. After removing the aggregate goal, I don't have the issue anymore
Upvotes: 0
Reputation: 35901
It is not sensible to run mvn package verify
.
Just run mvn verify
and you'll be fine.
verify
already includes package
.
Upvotes: 1