Demo: untangling a dependency conflict with dependency:tree
On This Lesson 3 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
find and fix a version conflict. Prepares JNR-002-LAB1.
Draft outline details
Step by step
- Show an app that fails at run time with
NoSuchMethodError. - Run
./mvnw dependency:tree -Dverboseand search for the library name. - Find that two dependencies request different versions.
- Planned mistake: add an exclusion on the wrong dependency, and the error remains. Fix: read the tree again and exclude from the right one, or better, pin the version in
dependencyManagement. - Run
./mvnw verifyand confirm green. - Write one sentence in the README on the cause.
Check your understanding
Better than an exclusion for a shared library?
Show answer
Pin the version once in dependencyManagement.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.