tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Build Tools > Maven > How to resolve JAR version conflicts using the dependency tree

How to resolve JAR version conflicts using the dependency tree

Author: Venkata Sudhakar

It's very easy to identify JAR version conflicts using Maven Dependency Tree or Eclipse Dependency Hierarchy. Basically maven uses the principle of nearest wins strategy (nearest to the root in dependency tree) for resolving the dependency conflicts. In the below example commons-beanutils version 1.9.4 (level 2) has been ignored in favor of version 1.9.3 (level 1). In case multiple versions of the same JAR dependency is available at the same level in the dependency tree then the first occurance of JAR version is used.

mvn dependency:tree -Dverbose -Dincludes=commons-beanutils

It gives the following output,

[INFO] com.bethecoder.web:backend:war:1.0-SNAPSHOT
[INFO] +- commons-beanutils:commons-beanutils:jar:1.9.3:compile
[INFO] \- com.opencsv:opencsv:jar:5.2:compile
[INFO]    \- (commons-beanutils:commons-beanutils:jar:1.9.4:compile - omitted for conflict with 1.9.3)


 
  


  
bl  br