Repaso
EspaƱol
Maven, Git & SDLCIntermediateVCS-06

What is a transitive dependency?

Options

  1. A dependency that changes very often between releases
  2. A library you did not declare, pulled in by another one (Correct option)
  3. A dependency that is only used while running the tests
  4. 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:tree

Remember

Transitive = dependencies of your dependencies.

Key terms

Practice this question in Repaso