What is a transitive dependency?
Options
- A dependency that changes very often between releases
- A library you did not declare, pulled in by another one (Correct option)
- A dependency that is only used while running the tests
- A library written in another programming language
Answer
A library you did not declare, pulled in because one of your dependencies needs it
Why
If your project depends on library A, and A depends on B, Maven also downloads B for you: B is a transitive dependency.
It is convenient, but it can cause version conflicts when two libraries need different versions of C. Maven resolves it with "nearest definition wins": the version closest to your project in the dependency tree.
Inspect the tree with mvn dependency:tree; exclude or pin versions with <exclusions> or dependencyManagement.
mvn dependency:treeRemember
Transitive = dependencies of your dependencies.