How to resolve maven dependency conflicts

When dealing with lots of maven dependencies we normally ends up with conflicts. This can be due to different versions of same library in classpath. In this case we have to manually identify the exact maven dependencies with which this library is added.

Maven provides an option to list all the libraries added to classpath due to the dependencies in maven pom file. We can get this by running below command from the path where the pom.xml is available.

mvn dependency:tree -Dverbose

If we are trying to find any specific library we can execute below command:

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

 

Leave a Reply

Your email address will not be published. Required fields are marked *