Skip to content
Ameen Abozaid
In reviewJNR-002-L03

Version conflicts and dependency management

  • Lesson 3 of 8
  • 11 min read
  • Junior
On This Lesson 4 topics

The content for this lesson is written and waiting for review. The outline below shows what it covers. It will be published once it is approved.

In this lesson

resolve two versions of the same library.

Planned topics

  • Two dependencies may need different versions of one library. Maven picks one jar.
  • Default rule: the nearest definition in the tree wins, not the newest.
  • That may pick a version that breaks the other library.
  • Fix it with <dependencyManagement>: you state the version once, for everyone.
  • <exclusions> remove a dependency you do not want.
Draft outline details

Demonstration

xml
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson.version}</version>
    </dependency>
  </dependencies>
</dependencyManagement>

Check your understanding

Which version does Maven pick in a conflict by default?

Show answer

The nearest one in the tree.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.