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?
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:treemaven plugin should do what you want and show the tree.Alternatively force Maven2 to copy dependencies into target/lib to copy the the artifacts in the
target/libdirectory which should also show duplicates but you would still need to grep all the POMs in the~/.m2/repositoryto see which library is pulling in which version manually and that would be time consuming for large local repositories.