Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-42302

maven-shade-plugin uses a temporary project file "dependency-reduced-pom.xml" that is deleted when "withMaven()" collects the artifacts

XMLWordPrintable

      maven-shade-plugin uses a temporary project file "dependency-reduced-pom.xml" instead of "pom.xml" and deletes this temporary file "dependency-reduced-pom.xml" at the end of the build.

      When withMaven() processes the build report, the file basedir/dependency-reduced-pom.xml no longer exist.

      https://github.com/apache/maven-plugins/blob/3964d2a2c3b5d2c3b73b8685755e772cfabeea40/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java

      public class ShadeMojo extends AbstractMojo implements Contextualizable {
          /**
           * Flag whether to generate a simplified POM for the shaded artifact. If set to <code>true</code>, dependencies that
           * have been included into the uber JAR will be removed from the <code>&lt;dependencies&gt;</code> section of the
           * generated POM. The reduced POM will be named <code>dependency-reduced-pom.xml</code> and is stored into the same
           * directory as the shaded artifact. Unless you also specify dependencyReducedPomLocation, the plugin will create a
           * temporary file named <code>dependency-reduced-pom.xml</code> in the project basedir.
           */
          @Parameter( defaultValue = "true" )
          private boolean createDependencyReducedPom;
      
          /**
           * Where to put the dependency reduced pom. Note: setting a value for this parameter with a directory other than
           * ${basedir} will change the value of ${basedir} for all executions that come after the shade execution. This is
           * often not what you want. This is considered an open issue with this plugin.
           *
           * @since 1.7
           */
          @Parameter( defaultValue = "${basedir}/dependency-reduced-pom.xml" )
          private File dependencyReducedPomLocation;
      
      

            cleclerc Cyrille Le Clerc
            cleclerc Cyrille Le Clerc
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: