Maven "shaded" JAR is prefixed with "original" in the file name
I know this question is old, but thought it was worth adding the following information.
I think the output originally desired by Steve is that given on this page of the maven-shade-plugin documentation.
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>jar-with-dependencies</shadedClassifierName>
Maven's build steps will create the jar target/artifact-version.jar
.
Then the shade plugin runs. It normally renames that jar to target/original-artifact-version.jar
, and gives the shaded JAR the name target/artifact-version.jar
.
However, you're configuring the Shade plugin to use a different name. Unless there's a good reason for that, I'd remove <finalName>
from your configuration, and live with what the Shade plugin wants to give you.
Following @Stewart on providing a slightly better answer (no offense to either :D):
The reason you get the original-* mess can be twofold:
Specifying
<finalName>
means you want a name different than what Maven gives you by default (ie: same as artifact's name: artifactId-version.jar or artifactId-version-shaded.jar). If you specify a final name that is the same as one of the two, it will try to back the old one up as original-*.jar and then overwrite it with the new shaded one. In your case, you're telling it to make the final JAR *-shaded.jar, which is already the case when it comes out of Maven (before they by default make it into artifactId-version.jar), so it first backs up the old*-shaded.jar
asoriginal-*-shaded.jar
and then bugs out when writing the bytes to the new*-shaded.jar
given the old one disappeared (they seem to rename it).(Which was my case) Using
<shadedClassifierName>
, which changes only the suffix Maven uses to generate the *-shaded.jar, in combination with<finalName>
can also yield the same results. If you want you can just use<shadedClassifierName>
and specify a different suffix and be done with it without having to specify<finalName>
with the whole thing. In my case I had both set up to name the output the same thing: ie: artifactId-version-all.jar but using 'all' as Classifier brought me back to the scenario described in #1.