How can I view transitive dependencies of a Maven pom.xml file?

ryan picture ryan · May 24, 2011 · Viewed 41.2k times · Source

Is there a CLI tool I can use to quickly view the transitive dependencies of a Maven pom.xml file?

Answer

Sean Patrick Floyd picture Sean Patrick Floyd · May 24, 2011

On the CLI, use mvn dependency:tree
(Here are some additional Usage notes)

When running dependency:tree on multi-module maven project, use mvn compile dependency:tree instead1.

Otherwise, the POM Editor in M2Eclipse (Maven integration for Eclipse) is very good, and it includes a hierarchical dependency view.


1If you don't compile, you might get error Failed to execute goal on project baseproject: Could not resolve dependencies for project com.company:childproject:jar:1.0.0: Could not find artifact. This might happen because dependency:tree command doesn't build projects and doesn't resolve dependencies, and your projects are not installed in maven repository.