如何获取工件的依赖树? [英] how to get a dependency tree for an artifact?
问题描述
依赖关系:可以使用树来查看给定项目的依赖关系树。但是我需要的是查看第三方工件的依赖关系树。我想我可以创建一个空项目,但我正在寻找一些更简单的东西(我需要为几个工件做这个)。
dependency:tree can be used to see the dependency tree for a given project. But what I need is to see the dependency tree for a 3rd party artifact. I guess I can create an empty project, but I'm looking for something easier (I need to do this for several artifacts).
推荐答案
1)使用 maven依赖插件
仅使用pom.xml创建一个简单的项目。添加您的依赖关系并运行:
1) Use maven dependency plugin
Create a simple project with pom.xml only. Add your dependency and run:
mvn dependency:tree
不幸的是,依赖mojo 必须使用pom.xml或者您收到以下错误:
Unfortunately dependency mojo must use pom.xml or you get following error:
无法执行mojo:tree。它需要一个具有现有pom.xml的项目,但是构建没有使用。
Cannot execute mojo: tree. It requires a project with an existing pom.xml, but the build is not using one.
2)查找您的pom.xml工件
在您的工件的pom.xml中,是描述的依赖关系。
请参阅 org.springframework的示例:spring-core
依赖关系的一部分工件是一个pom.xml。这表明它是依赖关系。你可以在这个pom上执行 mvn依赖:tree 。
Part of dependency artifact is a pom.xml. That specifies it's dependency. And you can execute mvn dependency:tree on this pom.
这篇关于如何获取工件的依赖树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!