Uploaded image for project: 'Maven Shade Plugin'
  1. Maven Shade Plugin
  2. MSHADE-239

Shaded Source JAR not following finalName pattern

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.4.3
    • Fix Version/s: 3.0.0
    • Labels:
      None

      Description

      When enabling the <createSourcesJar> and <shadedSourcesContent> configurations, while also using a custom naming scheme in <finalName>, the sources JAR is named incorrectly.

      For instance, given the following configuration:

      <configuration>
          <finalName>${project.artifactId}-${project.version}-${some-other-crap}-exe</finalName>
          <createSourcesJar>true</createSourcesJar>
          <shadedSourcesContent>true</shadedSourcesContent>
          <shadedArtifactAttached>true</shadedArtifactAttached>
          <shadedClassifierName>exe</shadedClassifierName>
      </configuration>
      

      The shaded artifact is appropriately named artifact-version-crapola-exe.jar, while the source jar is named artifact-version-exe-sources.jar (note the missing "-crapola", from the variable ${some-other-crap} in <finalName>). The correct name should be artifact-version-crapola-exe-sources.jar (i.e. ${finalName}-sources.jar).

      As a side note: it might be a good idea to enable the use of a ${shadedClassifierName} variable that can be referenced and interpolated within the <finalName> evaluation.

        Activity

        Hide
        diego.rivera.cr@gmail.com Diego Rivera added a comment -

        Patch file for applying the same <finalName> value to the sources and tests shaded JARs.

        Show
        diego.rivera.cr@gmail.com Diego Rivera added a comment - Patch file for applying the same <finalName> value to the sources and tests shaded JARs.
        Hide
        rfscholte Robert Scholte added a comment -

        Fixed in r1779371
        Thanks for the patch, I've changed it a bit because a test exposed a copy/paste issue.

        Show
        rfscholte Robert Scholte added a comment - Fixed in r1779371 Thanks for the patch, I've changed it a bit because a test exposed a copy/paste issue.
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build maven-plugins #8595 (See https://builds.apache.org/job/maven-plugins/8595/)
        MSHADE-239 Shaded Source JAR not following finalName pattern
        Contributed by Diego Rivera, verified and adjusted by Robert Scholte (rfscholte: http://svn.apache.org/viewvc/?view=rev&rev=1779371)

        • (add) maven-shade-plugin/src/it/MSHADE-239_finalName-attachments
        • (add) maven-shade-plugin/src/it/MSHADE-239_finalName-attachments/pom.xml
        • (add) maven-shade-plugin/src/it/MSHADE-239_finalName-attachments/verify.groovy
        • (edit) maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-plugins #8595 (See https://builds.apache.org/job/maven-plugins/8595/ ) MSHADE-239 Shaded Source JAR not following finalName pattern Contributed by Diego Rivera, verified and adjusted by Robert Scholte (rfscholte: http://svn.apache.org/viewvc/?view=rev&rev=1779371 ) (add) maven-shade-plugin/src/it/ MSHADE-239 _finalName-attachments (add) maven-shade-plugin/src/it/ MSHADE-239 _finalName-attachments/pom.xml (add) maven-shade-plugin/src/it/ MSHADE-239 _finalName-attachments/verify.groovy (edit) maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java

          People

          • Assignee:
            rfscholte Robert Scholte
            Reporter:
            diego.rivera.cr@gmail.com Diego Rivera
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development