View a dependency tree in Maven?

前端 未结 3 2000
隐瞒了意图╮
隐瞒了意图╮ 2020-12-15 04:50

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,

相关标签:
3条回答
  • 2020-12-15 05:13

    If you'd like to get a graphical, searchable representation of the dependency tree (including all modules from your project, transitive dependencies and eviction information), check out UpdateImpact: https://app.updateimpact.com (free service).

    Using the search, you can find out how many times a given library is imported, by what modules and in which versions, as well as verify if older versions of a library are evicted by newer ones.

    Disclaimer: I'm one of the developers of the site

    0 讨论(0)
  • 2020-12-15 05:29

    Duplicate libraries can be a problem, but duplicate classes can exist even if no libraries are duplicated. JBoss Tattletale can analyze a set of jar files and produce a report which lists all duplicated classes. There’s a Maven plugin for running the report - see http://docs.jboss.org/tattletale/userguide/1.2/en-US/html/maven.html

    0 讨论(0)
  • 2020-12-15 05:35

    The dependency:tree maven 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/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.

    0 讨论(0)
提交回复
热议问题