在Maven中查看依赖关系树? [英] View a dependency tree in Maven?

查看:267
本文介绍了在Maven中查看依赖关系树?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想确保我的Maven项目中没有重复的库.我从几个不同的存储库(包括main,Spring的repo和JBoss的存储库)中引入了很多依赖项.如何查看依赖关系图,以确保不依赖单个库的多个版本?

I'd like to make sure I'm not including duplicate libraries in my Maven project. I'm pulling in quite a few dependencies from a few different repositories including main, Spring's repo, and JBoss' repository. How can I see a graph of the dependencies so I can make sure I'm not depending on multiple versions of a single library?

如果我包含诸如org.springframework:spring-core:3.0.1.RELEASE org.springframework:org.springframework.spring-core:3.0.5.RELEASE之类的东西的话,那真是太可惜了,听起来确实很奇怪,因为Spring的存储库为事物命名怪异的.我该怎么做才能确保我没有重复的依赖关系?

It would be kind of a bummer if I was including something like org.springframework:spring-core:3.0.1.RELEASE and org.springframework:org.springframework.spring-core:3.0.5.RELEASE which actually do show up as different dependencies, as weird as it sounds, because Spring's repository names things weirdly. What can I do to make sure I don't have duplicate dependencies?

推荐答案

The dependency:tree maven plugin should do what you want and show the tree.

或者强制Maven2将依赖项复制到target/lib 将工件复制到target/lib目录中,该工件也应显示重复项,但是您仍然需要grep ~/.m2/repository中的所有POM,以查看哪个库正在手动将哪个版本拉入库,并且这对于大型库来说是耗时的本地存储库.

Alternatively force Maven2 to copy dependencies into target/lib to copy the the artifacts in the target/lib directory which should also show duplicates but you would still need to grep all the POMs in the ~/.m2/repository to see which library is pulling in which version manually and that would be time consuming for large local repositories.

这篇关于在Maven中查看依赖关系树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆