maven dependency reduce
dependency-reduced-pom.xml 文件的价值:
point 1:
Finally this is what I think: lets say you have a project with dependencies A, B, C, D, E. In the pom.xml you configure the shade plugin in such a way that when it creates the uber-jar (call it foo.jar), it includes A, B, C in the shaded jar but for some reason you decide not to include D, E in the shaded jar even though your project depends on them - a case in point are dependencies that are needed only for testing (e.g. any dependency that has a scope of test and is not included in the shaded jar). The dependency-reduced-pom.xml will define D, E in it. The idea is that if someone wants to use foo.jar the dependency-reduced-pom.xml provides a hint of some sort that beware foo.jar is missing dependencies D, E in it - use at your own risk. You might then decide to explicitly add D, E in the project that will use foo.jar.
So the dependency-reduced-pom.xml is more like missing-dependencies.xml and lists the dependencies which are missing in the uber-jar which is output by the shade plugin.
point 2:
While having createDependencyReducedPom set to true is useful when using the shaded artifact (jar) as a dependency for other projects, I have recently encountered an issue where running my multi-module maven build in parallel with more than 1 thread would cause the maven-shade-plugin to go into an infinite loop and block the build forever.
Disabling the creation of dependency-reduced-pom files is the way to get around that issue for me.
Another reason why you wouldn't want to create dependency-reduced-pom is when the shaded jar being built is an application and not a library to be resued elsewhere.
3 避免重复的方式:
指定该文件的生成目录,避免干扰当前项目pom
参考资料
createDependencyReducedPom
what-is-the-purpose-of-dependency-reduced-pom-xml-generated-by-the-shade-plugin
is-dependency-reduced-pom-xml-automatically-used-instead-of-pom-xml?rq=1