Take the 2-minute tour ×

I just experienced a case of two direct dependencies of my maven project having two different versions of a particular transitive dependency.

In my particular case I had direct dependencies on the following:




Both of these dependencies had a (deep) transitive dependency on com.sun.jersey:jersey-core, but with different versions for each. Maven didn't fail on this or even warn (or if it did, I never saw it!) that such a thing was happening... and as such I never noticed it until debugging a problem that happened when the version of jersey-core brought in by the jclouds dependency caused some things to break.

Is there a maven plugin or some other tool that exists that will detect this sort of deep transitive dependency overriding and at least warn the user (or fail the maven execution) if it detects such a collision... even if the default maven behavior is to just pick the first version that appears when resolving dependencies?

share|improve this question
add comment

4 Answers

up vote 9 down vote accepted

Use the Dependency Enforcer plugin. It will stop the build when dependencies don't converge properly.

            <DependencyConvergence />
share|improve this answer
this appears to be exactly what I was looking for. I didn't think to check the enforcer plugin for this. –  whaley Mar 21 '12 at 12:22
add comment

you could run depenency report or use dependency tree:

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

share|improve this answer
add comment

You could just have a look at your dependency hiercharchy overview. This won't warn you, but you can see if certain versions are discarded for newer versions of the same library.

share|improve this answer
are you referring to running dependency:tree with verbose specified as @DmitryB suggested? –  whaley Mar 21 '12 at 1:37
add comment

You can resolve the version conflict by excluding the non wanted version from the apropriate dependency. For example:


Or you add com.sun.jersey:jersey-core with the wanted version to your dependencies. Maven resolves version confilicts by supporting the dependency which is closest to the dependencies root.

share|improve this answer
I know how to resolve the problem. What I want is for maven to tell me there is a potential problem to begin with. –  whaley Mar 21 '12 at 12:19
add comment

Your Answer


