Issue
Is there a CLI tool I can use to quickly view the transitive dependencies of a Maven pom.xml
file?
Solution
On the CLI, use href="http://maven.apache.org/plugins/maven-dependency-plugin/tree-mojo.html" rel="noreferrer">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.
Answered By - Sean Patrick Floyd
Answer Checked By - Mary Flores (JavaFixing Volunteer)