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?
The dependency-reduced-pom. xml removes transitive dependencies which are already in your shaded jar. This prevents consumers from pulling them in twice.
This plugin provides the capability to package the artifact in an uber-jar, including its dependencies and to shade - i.e. rename - the packages of some of the dependencies.
Shading is an extension to the uber JAR idea which is typically limited to use cases where. The JAR is a library to be used inside another application/library. The authors of the JAR want to be sure that the dependencies used by the JAR are in their control.
A Maven artifact classifier is an optional and arbitrary string that gets appended to the generated artifact's name just after its version number. It distinguishes the artifacts built from the same POM but differing in content.
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 more detail from apache
Based on bmargulies' answer and his comment on Xv.'s answer, I decided to configure the dependency-reduced POM to be output to target/
, which is already ignored in my VCS.
To do that, I just added the dependencyReducedPomLocation
element to the configuration
element of the plugin, i.e.
<configuration> <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation> (...) </configuration>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With