[英]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.