Maven依赖项:树未显示所有传递依赖项 [英] Maven dependency:tree is not showing all transitive dependencies
问题描述
我很难理解 depencendy:tree 输出的行为.在更高模块上运行插件时,我从其依赖的模块中丢失了重要信息.但是,当我在下部模块上运行插件时,我可以看到这种依赖关系.这是显示问题(名称更改)的示例:
I have trouble understanding the behaviour of the depencendy:tree output. When running the plugin on a higher module, I am missing vital information from modules it depends on. But when I run the plugin on the lower module I can see the depencendies. Here is an example to show the problem (names changed):
mvn -pl foo:bar-application dependency:tree -Dincludes=foo:*
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building bar-application 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ bar-application ---
[INFO] foo:bar-application:ear:0.0.1-SNAPSHOT
[INFO] +- foo:bar-business:ejb:0.0.1-SNAPSHOT:compile
[INFO] | +- foo:common-util:jar:0.0.1-SNAPSHOT:compile
...
[INFO] +- foo:bar-web:war:0.0.1-SNAPSHOT:compile
[INFO] \- foo:common-logging:jar:0.0.1-SNAPSHOT:compile
[INFO] ------------------------------------------------------------------------
树显示了与 bar-web 的依赖关系,但是从 bar-web 到其他项目的依赖关系只有一个( common-logging ).
The tree shows a depencendy to bar-web, but only one further depencendy from bar-web to other projects (common-logging).
但是 bar-web 具有更多的依赖性:
But bar-web has far more dependencies:
mvn -pl foo:bar-web dependency:tree -Dincludes=foo:*
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building bar-web 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ bar-web ---
[INFO] foo:bar-web:war:0.0.1-SNAPSHOT
[INFO] +- foo:common-logging:jar:0.0.1-SNAPSHOT:compile
[INFO] +- foo:culprit-business-client:jar:0.0.1-SNAPSHOT:compile
...
[INFO] +- foo:common-rest:jar:0.0.1-SNAPSHOT:compile
[INFO] | \- foo:config-business-client:jar:0.0.1-SNAPSHOT:compile
[INFO] \- foo:bar-business:jar:0.0.1-SNAPSHOT:provided
[INFO] \- foo:some-client:jar:0.0.1-SNAPSHOT:provided
[INFO] ------------------------------------------------------------------------
为什么在检查 bar-application 时未显示其他依赖项?我花了一段时间才找到罪魁祸首. 我正在使用
Why are the other dependencies not shown when inspecting bar-application? It took me a while of searching to find the culprit. Im a using
mvn --version
Apache Maven 3.0.5
推荐答案
WAR在归档文件中包含其依赖项,这就是Maven不会根据WAR工件将其传递给其他工件的原因.
A WAR includes its dependencies inside the archive, that's why Maven does not propagate them transitively to other artifacts depending on the WAR artifact.
这篇关于Maven依赖项:树未显示所有传递依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!