How to interpret failOnVersionConflict() output


(Etienne Studer) #1

Hi

Gradle reports a version conflict (failOnVersionConflict()), but running ‘gradle dependencies’ only shows one version in the dependency tree. How can that be?

  • What went wrong: Execution failed for task ‘:foo:dependencies’. > Could not resolve all dependencies for configuration ‘:foo:testCompile’.

A conflict was found between the following modules:

  • com.google.guava:guava:12.0

  • com.google.guava:guava:10.0.1

In the example above, there is a version conflict, but gradle dependencies will not show version 10.0.1 anywhere in the tree.

Regards, Etienne


(René Groeschke) #2

hey etienne, can you post a selfcontained build snippet to reproduce this?

cheers, René


(Etienne Studer) #3

Hi Rene

The general problem is that the output does not help to resolve any conflicts. Today, I had this output:

Could not resolve all dependencies for configuration ‘:edoras-bpm-execution-core:compile’. > A conflict was found between the following modules:

  • com.edorasware.commons:edoras-commons-core:2.1.0.S8-1

  • com.edorasware.commons:edoras-commons-core:2.1.0.S7

We have quite a few dependencies in our configurations and I do not know how to efficiently track down where these (possibly transitive) dependencies come from.

If the output displayed the full path for the affected dependencies, it would be easy to resolve the problem. Hence, please consider this a feature request / usability issue.

Regards, Etienne


(godwin.mark) #4

There doesn’t seem to be a good way to determine which version to use other than commenting out the ‘failOnVersionConflict()’ line and debugging dependencies by using ‘dependencyInsight’. Since we’re using groovy you can do something like the following:

configurations.all {
  resolutionStrategy {
    if (!project.hasProperty('debugDeps')) {
      failOnVersionConflict()
    }
    force ...
  }
}

And then when you run into a conflict you can now do:

gradle dependencyInsight --dependency <dependency> -PdebugDeps

Hope that helps until there’s a more ‘baked in’ way to do this!


(Raman Gupta) #5

See also: GRADLE-3033