Skip to content
Latchkey

mvn dependency:tree: Usage, Options & CI Errors

See the whole transitive graph - and exactly who pulls in that library.

dependency:tree is a goal of the maven-dependency-plugin that prints the project’s dependencies as a tree, including transitive ones and how Maven resolved version conflicts. It is the first tool to reach for when debugging a dependency clash.

What it does

dependency:tree walks the resolved dependency graph and prints it hierarchically, marking omitted/conflicting versions. With -Dverbose it shows conflicts that mediation removed; with -Dincludes it filters to a single coordinate to find who brings it in.

Common usage

Terminal
mvn dependency:tree
mvn dependency:tree -Dverbose
mvn dependency:tree -Dincludes=com.fasterxml.jackson.core:jackson-databind
mvn dependency:tree -DoutputFile=tree.txt

Common error in CI (and the fix)

Symptom: a NoSuchMethodError or NoClassDefFoundError at runtime from conflicting versions of the same library. Cause: two transitive paths request different versions and Maven’s nearest-wins mediation picked one that is incompatible. Fix: run dependency:tree -Dverbose -Dincludes=group:artifact to find both paths, then pin the wanted version in <dependencyManagement> or add an <exclusion> on the offending path.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →