dependency-reduced-pom.xml 是否自动使用而不是 pom.xml?

Is dependency-reduced-pom.xml automatically used instead of pom.xml?

是否dependency-reduced-pom.xmlMaven shade plugin创建自动用于依赖uberjar的项目(而不是普通的pom.xml)?

在阅读了一些减少依赖性的pom.xml相关问题后提出这个问题,但还没有找到答案:

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

What is the purpose of dependency-reduced-pom.xml generated by the shade plugin?

What is `dependency-reduced-pom.xml` file which created when calling maven package command?

dependency-reduced-pom.xml 在构建时生成到项目的 ${basedir} 中。该文件是一个临时文件,仅用于打包到 shaded jar 中。引用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 <dependencies> 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.

说清楚,在maven-shade-plugin之后有运行:

  • 您的初始 POM 将保持不变;
  • 将在根文件夹(this is considered an open issue with this plugin) 中生成一个您可以完全忽略的名为dependency-reduced-pom.xml 的临时文件(this is considered an open issue with this plugin);
  • 阴影工件将在 META-INF 目录中包含未更改的初始 POM,而不是减少的 POM(这不是很重要,但最好提及它 - 有一个关于此的问题已自动关闭:MSHADE-36);
  • 将部署的 POM 是缩减的 POM;
  • 默认情况下,阴影工件将成为项目的主要工件。