简体   繁体   English

如何使用Maven获得项目的所有嵌套依赖关系?

[英]How can I get all nested dependencies of a project using Maven?

I am working with a project (java) , I have a pom that calls a parent pom... 我正在使用一个项目(java),我有一个pom,它称为父pom ...

That parent pom calls other poms and they call other poms. 那个父母pom叫其他pom,他们叫其他pom。 So, at the end I have a project whos pom calls other projects, so I am able to use them calling their methods and all (But I dont use. At the end, my project calls another 20 other projects with their own poms, methods, services and so on... 因此,最后我有一个项目,谁的pom调用了其他项目,因此我可以使用它们调用他们的方法以及所有方法(但是我不使用。最后,我的项目使用自己的pom,方法来调用另外20个项目,服务等...

Between all this mess I realized my project might not be using all other projects, so, I would like to get just the right dependencies I need, take them out from the other projects and include them at my local project. 在所有这些混乱之中,我意识到我的项目可能不会使用所有其他项目,因此,我想得到我所需的正确依赖项,将它们从其他项目中删除,并将其包括在我的本地项目中。 Some of those included projects might call each other creating some errors. 其中一些包含的项目可能会相互调用,从而产生一些错误。

I thought I had cleaned up this project including only the right dependencies, but then I get a Dependency convergence error 我以为我已经清理了这个项目,只包括正确的依赖项,但是然后我得到了一个Dependency convergence error

Is there any way I can track all dependencies used by my project and the dependencies used by my included projects(nested dependencies) all by once? 有什么办法可以一次跟踪项目使用的所有依赖项和包含的项目使用的依赖项(嵌套依赖项)?

Thanks 谢谢

Have you tried the maven-dependency-plugin? 您是否尝试过maven-dependency-plugin? You get a list of dependencies grouped by Used undeclared dependencies or Unused declared dependencies 您将获得按使用的未声明的依赖项或未使用的已声明的依赖项分组的依赖项列表

mvn dependency:analyze mvn依赖关系:分析

or to see mismatches in your dependencyManagement section use: 或在您的dependencyManagement部分中查看不匹配项,请使用:

mvn dependency:analyze-dep-mgt mvn依赖项:analyze-dep-mgt

Also helpful is 同样有帮助的是

mvn dependency:tree mvn依赖项:树

for a complete dependency tree. 一个完整的依赖树。 You have more options, see maven-dependency-plugin usage for more details. 您有更多选择,请参阅maven-dependency-plugin用法以获取更多详细信息。

Using the dependency plugin: 使用依赖插件:

% mvn dependency:tree -Dverbose -Dincludes=commons-collections
[INFO] [dependency:tree]
[INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT
[INFO] +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4:compile
[INFO] |  \- commons-validator:commons-validator:jar:1.2.0:compile
[INFO] |     \- commons-digester:commons-digester:jar:1.6:compile
[INFO] |        \- (commons-collections:commons-collections:jar:2.1:compile - omitted for conflict with 2.0)
[INFO] \- org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile
[INFO]    \- org.codehaus.plexus:plexus-velocity:jar:1.1.3:compile
[INFO]       \- commons-collections:commons-collections:jar:2.0:compile

Hope that helps. 希望能有所帮助。

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

相关问题 获取Maven项目的所有依赖项 - Get all dependencies of a maven project Maven3:如何获取自定义 Maven 扩展中的所有项目依赖项 - Maven3 : How to get all the project dependencies in a Custom Maven Extension 如何在Intellij Idea中运行Maven项目(并下载所有依赖项)? - How can I run a Maven project in Intellij Idea (and have all dependencies downloaded)? 如何获取 Maven 项目的直接(非传递)依赖项? - How do I get the direct (non transitive) dependencies of a Maven project? 如何检查Maven POM中使用的所有依赖项? - How can I checkout all dependencies used in a Maven POM? 如何使用Maven管理项目依赖项? - How to manage project dependencies using Maven? 如何获取Maven包的所有依赖 - How to get all the dependencies of Maven packages 如何使用 Maven 创建具有依赖关系的可执行 JAR? - How can I create an executable JAR with dependencies using Maven? 如何使用Maven创建一个没有依赖关系的可执行jar? - How can I create an executable jar without dependencies using Maven? 如何使用Maven Artifact Resolver解决Maven依赖关系并获取所有传递依赖关系? - How to resolve maven dependency and get all the transitive dependencies using Maven Artifact Resolver?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM