Consider a very common situation when a project depends on 2 libraries, each transitively bringing a 3rd library of different versions:
Project A:
Library B:
Library D: version 1
Library C:
Library D: version 2
I can use maven enforcer plugin's dependencyConvergence rule to detect such problems and then directly specify the version of Library D in my Project A's pom in e.g. <dependencyManagement> section.
But this creates another problem: now I have to manually track the version of library D even though my project does not directly use it.
Every time I change the version of either library B or library C, I have to remember to also update the version of library D in my project. It's very easy to forget!
Is there a way to tell maven to just use the newest version of a transitive library?
Something like:
<dependencyManagement>
...
<dependency>
<groupId>path.to</groupId>
<artifactId>library-D</artifactId>
<version>
<use_newest_one_from_all_transitive_dependencies_please/>
</version>
</dependency>
Is there a way to achieve this?