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

Maven 2MavenDependenciespom.xml

Maven 2 Problem Overview


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

Maven 2 Solutions


Solution 1 - Maven 2

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionryanView Question on Stackoverflow
Solution 1 - Maven 2Sean Patrick FloydView Answer on Stackoverflow