是否自动使用dependency-reduced-pom.xml而不是pom.xml? [英] Is dependency-reduced-pom.xml automatically used instead of pom.xml?
问题描述
由 Maven阴影插件 自动创建的dependency-reduced-pom.xml
用于依赖uberjar的项目(而不是普通的pom.xml
)吗?
在阅读了一些与dependency-reduced-pom.xml相关的问题之后,还没有找到答案,就问了这个问题:
Asking this after reading a number of dependency-reduced-pom.xml related questions and haven't founding the answer:
Maven阴影插件添加了减少依赖的功能-pom.xml到基本目录
什么插件生成的dependency-reduced-pom.xml的目的是什么?
什么是`调用maven软件包命令时创建的dependency-reduced-pom.xml文件?
推荐答案
dependency-reduced-pom.xml
是在构建时生成到项目的${basedir}
中的.该文件是一个临时文件,仅用于包装到有阴影的jar中.引用 createDependencyReducedPom
属性的文档:
The dependency-reduced-pom.xml
is generated at build time into ${basedir}
of the project. This file is a temporary file that is only used for packaging into the shaded jar. Quoting the documentation of the createDependencyReducedPom
attribute:
标记是否为阴影伪像生成简化的POM.如果设置为
true
,则会从生成的POM的<dependencies>
部分中删除uber JAR中已包含的依赖项.减少的POM将被命名为dependency-reduced-pom.xml
,并被存储在与阴影工件相同的目录中.除非您也指定dependencyReducedPomLocation
,否则插件将在基于项目的项目中创建一个名为dependency-reduced-pom.xml
的临时文件.
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 nameddependency-reduced-pom.xml
and is stored into the same directory as the shaded artifact. Unless you also specifydependencyReducedPomLocation
, the plugin will create a temporary file nameddependency-reduced-pom.xml
in the project basedir.
为了清楚起见,请在maven-shade-plugin
运行后:
To make it clear, after the maven-shade-plugin
has run:
- 您的初始POM将保持不变;
- 将在根文件夹中生成一个可以完全忽略的名为
dependency-reduced-pom.xml
的临时文件(MSHADE-36 ); - 将要部署的POM是简化的POM;
- 带阴影的工件默认情况下将是项目的主要工件.
- your initial POM will be left unchanged;
- a temporary file that you can completely ignore named
dependency-reduced-pom.xml
will have been generated inside the root folder (this is considered an open issue with this plugin); - the shaded artifact will contain your initial POM unchanged inside the
META-INF
directory and not the reduced POM (this is not really important but better mention it - there was an issue about this that was closed automatically: MSHADE-36); - the POM that will be deployed is the reduced POM;
- the shaded artifact will be by default the main artifact of the project.
这篇关于是否自动使用dependency-reduced-pom.xml而不是pom.xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!