Joe White
Joe White

Reputation: 97696

How can I find out why a particular Maven package is being included?

Given a Maven project, how can I tell which of its immediate dependencies is causing a particular transitive dependency to be brought in?

E.g., I have a module that has a number of <dependency>s from Maven Central, and each of those has its own dependencies, etc. When I build, it's pulling in a (transitive) dependency I didn't expect.

How can I find out which of my module's immediate dependencies is causing transitive library-X-version-Y to be pulled in? Ideally I'd like to see the whole chain (or multiple chains if applicable), e.g. xyz:1.0.0 -> uvw:32.1 -> rst:9.9 -> abc:1.2.3, or anything else to help me figure out why this dependency is there.

Upvotes: 0

Views: 767

Answers (1)

Allen D. Ball
Allen D. Ball

Reputation: 2026

mvn dependency:tree will give you the output you're looking for.

Upvotes: 2

Related Questions