maven-shade-plugin output with shadedArtifactAttached false overwritten by install

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

maven-shade-plugin output with shadedArtifactAttached false overwritten by install

Karin Colsman
Dear list members,

I am having a problem with deploying jar files created by the maven-shade-plugin. It used to work, but it has stopped working. From my research the problem seems to be that the install step is overwriting the shaded jar.

Please cc me when replying, because I haven't subscribed to the list.

Thank you very much for your time!

Now all the tl;dr details - please let me know if you need more.

If I use the following setting:


It will create a fat jar for me, but If I change that to


installing/deploying will remove the dependencies and the manifest entry for the main class.

I don't want to use the "true" setting, because the file rename will break all my tooling that depends on a generic script that will a deployed artifact via CURL.

So, when I run

    $ mvn -s ../.m2/settings.xml --batch-mode --errors --fail-at-end --show-version clean package shade:shade

I get the correct files: ontology-merger-0.3.31.jar (big file) and original-ontology-merger-0.3.31 (small file)

when I run

    $ mvn -s ../.m2/settings.xml --batch-mode --errors --fail-at-end --show-version clean package shade:shade install

the install step will trash the shaded jar. I am assuming that this happens because it's running the maven-jar-plugin over it, although I don't mention the maven-jar-plugin anywhere in my pom.xml. I have no idea how to switch this off.

Important bits from the log:

[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing C:\dev\allotrope\source\ontology-qa-tools\merger\target\ontology-merger-0.3.31.jar with C:\dev\allotrope\source\ontology-qa-tools\merger\target\ontology-merger-0.3.31-shaded.jar
[INFO] Dependency-reduced POM written at: C:\dev\allotrope\source\ontology-qa-tools\merger\dependency-reduced-pom.xml
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ontology-merger ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ ontology-merger ---
[INFO] Nothing to compile - all classes are up to date
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ontology-merger ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 30 resources
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ ontology-merger ---
[INFO] No sources to compile
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ ontology-merger ---
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ ontology-merger ---
[INFO] Building jar: C:\dev\allotrope\source\ontology-qa-tools\merger\target\ontology-merger-0.3.31.jar
[INFO] --- maven-install-plugin:2.4:install (default-install) @ ontology-merger ---
[INFO] Installing C:\dev\allotrope\source\ontology-qa-tools\merger\target\ontology-merger-0.3.31.jar to C:\Users\User\.m2\repository\com\osthus\ontology-merger\0.3.31\ontology-merger-0.3.31.jar
[INFO] Installing C:\dev\allotrope\source\ontology-qa-tools\merger\dependency-reduced-pom.xml to C:\Users\User\.m2\repository\com\osthus\ontology-merger\0.3.31\ontology-merger-0.3.31.pom

The section in my pom.xml currently looks like this:

                                                                implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                                                                implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
                                                                        <!-- Some jars are signed but shading breaks that. Don't include
                                                                                signing files. -->

My various fix attempts are in this branch:

Path to the pom.xml:

A bit of history:

My deployment that had been working for years without a hitch already broke recently and I fixed it last month via


where I had to add some boilerplate to the pom.xml files and change

    $ mvn -s ../.m2/settings.xml --batch-mode --errors --fail-at-end --show-version clean deploy


    $ mvn -s ../.m2/settings.xml --batch-mode --errors --fail-at-end --show-version clean package shade:shade deploy

Thank again for your time and kind regards

Karin Colsman

To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]