简体   繁体   English

为什么在Maven树中未将POM类型的依存关系显示为传递依存关系?

[英]Why are POM-typed dependencies not shown as transitive dependencies in the Maven tree?

When I have a project that includes a POM, eg like this: 当我有一个包含POM的项目时,例如:

<dependency>
<groupId>org.jboss.arquillian</groupId
<artifactId>arquillian-bom</artifactId
<version>1.1.2.Final</version>  
<type>pom</type
<scope>test</scope>
</dependency>

then the POM is really downloaded to my local repository. 然后POM实际上会下载到我的本地存储库中。 And the POM contains a list of dependencies (I can check the POM file in my local repo, there is dependenManagement tag, and listed under there are a lot of dependencies, eg arquillian-config-api,shrinkwrap-descriptors-bom etc...), but those dependencies are not listed in mvn dependency:tree. POM包含一个依赖关系列表(我可以在本地存储库中检查POM文件,有dependenManagement标记,并且在下面列出了很多依赖关系,例如arquillian-config-api,shrinkwrap-descriptors-bom等。 。),但mvn依赖项:tree中未列出这些依赖项。 The dependency tree looks like this: 依赖关系树如下所示:

...
\- org.jboss.arquillian:arquillian-bom:pom:1.1.2.Final:test
(no more lines below it)
...

but actually I would expect that Maven would show those dependencies as transitive dependencies. 但实际上我希望Maven将这些依赖项显示为传递性依赖项。 When the type of a dependency is of type JAR, then transitive dependencies are really shown. 当依赖项的类型为JAR类型时,将真正显示可传递的依赖项。

Somehow, I think I don't understand what is the meaning of type "pom" when using Maven. 不知何故,我认为我在使用Maven时不理解“ pom”类型的含义是什么。

Until now, I thought it just means that instead of an artifact, it is just a POM that is inserted in the POM that is referring to it. 到现在为止,我认为这只是意味着不是一个工件,而是一个插入到引用它的POM中的POM。 So when I include a POM-typed dependency, the dependencies of the POM-type dependency are included. 因此,当我包含POM类型的依赖项时,也会包含POM类型的依赖项的依赖项。

But it seems that I am mistaken and the Maven documentation on the Internet has not helped me with this question. 但是似乎我弄错了,Internet上的Maven文档并没有帮助我解决这个问题。

Any ideas? 有任何想法吗?

POM type dependency is usually used to indicate the parent project in a parent child relational dependency hierarchy. POM类型依赖关系通常用于指示父子关系依赖项层次结构中的父项目。 POM type projects artifacts are not expanded in a maven reactor by default. 默认情况下,POM类型的项目工件不会在Maven反应器中扩展。 Only when a concrete type like jar, war etc is build in the reactor are the dependency tress created and expanded for debug logging. 仅当在反应堆中构建诸如jar,war等的具体类型时,才创建并扩展依赖项树以用于调试日志记录。

But you should not worry about it much. 但是您不必为此担心。 If you want to cross check these then the eclipse pom dependency hierarchy and effective pom tabs in the POM editor should be helpful. 如果要交叉检查这些内容,则POM编辑器中的eclipse pom依赖关系层次结构和有效的pom选项卡应该会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM