Reputation: 90003
The first time that maven-shade-plugin
runs, it:
This allows the maven-install-plugin
to pick up the shaded JAR file and everyone is happy. Unfortunately, the second time you run the build the maven-shade-plugin
now picks up the output from the first run as the input of the second run and you will end up with a slew of errors (e.g. overlapping classes/resources).
What is the easiest way to fix the plugin's behavior so it can be run over an over again without a mvn clean
step?
Upvotes: 1
Views: 166
Reputation: 90003
The easiest workaround is to instruct the JAR plugin to run even if the source files did not change. This will overwrite the shaded JAR and the maven-shade-plugin
will do the right thing:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<configuration>
<forceCreation>true</forceCreation>
</configuration>
</execution>
</executions>
</plugin>
Upvotes: 1