3

I use maven shade plugin in the package phase and I want that

  • the shaded jar becomes the main jar my-app.jar

  • the original jar is not renamed to original-my-app.jar but a custom classifier is applied to it, in particular my-app:no-deps.jar

  • finally I want that both jars are deployed with mvn deploy

My current setup has <shadedArtifactAttached>false</shadedArtifactAttached> which makes the shaded jar to be renamed as the main jar of the project and deployed (which is fine) but I don't get the original jar to be deployed and moreover I don't know how to rename it.

cb4
  • 6,689
  • 7
  • 45
  • 57
alexlipa
  • 1,131
  • 2
  • 12
  • 27

1 Answers1

3

You have decided to use <shadedArtifactAttached>false</shadedArtifactAttached> which implies that the shaded artifact will become the main artifact.

If you like to have both artifacts you have to use <shadedArtifactAttached>true</shadedArtifactAttached> which will make add the shaded artifact as a classifier artifact. This will result in having two artifacts one which is the main artifact under the groupId/artifactId and a supplemental artifact which can be addressed by using a classifier. This is by default shaded this means having groupId/artifactId/classifier in your pom to use that artifact instead of the main artifact.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235