gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 11:55:25 37 4
gpt4 key购买 nike

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

在阅读了一些与dependency-reduced-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}中。该文件是一个临时文件,仅用于包装到有色 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的临时文件;
  • 带阴影的 Artifact 将在META-INF目录中包含未更改的初始POM,而不包含简化的POM(这不是很重要,但最好提一下-存在一个已自动关闭的问题:MSHADE-36);
  • 将要部署的POM是简化的POM;
  • 默认情况下,阴影 Artifact 将成为项目的主要 Artifact 。
  • 关于maven - 是否自动使用dependency-reduced-pom.xml而不是pom.xml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35154717/

    37 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com