javamavenmaven-shade-plugin

Maven shade plugin adding dependency-reduced-pom.xml to base directory


The maven shade plugin is creating a file called dependency-reduced-pom.xml and also artifactname-shaded.jar and placing them in the base directory.

Is this a bug? Should be in the target directory. Any workaround?


Solution

  • You can avoid having it created by setting createDependencyReducedPom to false.

    e.g.

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>${maven-shade-plugin.version}</version>
        <configuration>
            <createDependencyReducedPom>false</createDependencyReducedPom>
        </configuration>
        ....
        ....
    </plugin>
    

    See http://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html#createDependencyReducedPom

    <createDependencyReducedPom>

    Flag whether to generate a simplified POM for the shaded artifact. If set to true, dependencies that have been included into the uber JAR will be removed from the section of the generated POM. The reduced POM will be named dependency-reduced-pom.xml and is stored into the same directory as the shaded artifact. Unless you also specify dependencyReducedPomLocation, the plugin will create a temporary file named dependency-reduced-pom.xml in the project basedir.

    • Type: boolean
    • Required: No
    • Default: true