Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

What is transitive dependency in pom xml?

Transitive dependency means that if A depends on B and B depends on C, then A depends on both B and C. Sometimes, transitivity brings a very serious problem when different versions of the same artifacts are included by different dependencies. It may cause version mismatch issues in runtime.

Which command used to find the missing transitive dependency in pom xml?

Run "mvn -X" command.

How do I find transitive dependencies in Eclipse?

With eclipse, you should try to edit the pom. There's a special tab named "Dependencies". From there, you should see your parent dependencies + you could consider choosing what version of dependency you want to keep.


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.