如何查看 Maven pom.xml 文件的传递依赖项? [英] How can I view transitive dependencies of a Maven pom.xml file?
问题描述
是否有 CLI 工具可以用来快速查看 Maven pom.xml 文件的传递依赖项?
Is there a CLI tool I can use to quickly view the transitive dependencies of a Maven pom.xml file?
推荐答案
在 CLI 上,使用 mvn 依赖:树
(这里有一些额外的使用说明)
On the CLI, use mvn dependency:tree
(Here are some additional Usage notes)
在多模块maven项目上运行dependency:tree
时,使用mvn compile dependency:tree
代替1.
When running dependency:tree
on multi-module maven project, use mvn compile dependency:tree
instead1.
另外,M2Eclipse(Eclipse的Maven集成)中的POM编辑器非常好,它包括一个分层依赖视图.
Otherwise, the POM Editor in M2Eclipse (Maven integration for Eclipse) is very good, and it includes a hierarchical dependency view.
1如果你不编译,你可能会得到错误 Failed to execute goal on project baseproject: could not resolve dependencies for project com.company:childproject:jar:1.0.0:找不到工件
.这可能是因为 dependency:tree
命令没有构建项目并且没有解析依赖关系,并且您的项目没有安装在 maven 存储库中.
1If you don't compile, you might get error Failed to execute goal on project baseproject: Could not resolve dependencies for project com.company:childproject:jar:1.0.0: Could not find artifact
. This might happen because dependency:tree
command doesn't build projects and doesn't resolve dependencies, and your projects are not installed in maven repository.
这篇关于如何查看 Maven pom.xml 文件的传递依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!