How to find the root dependencies for transitive conflicts?


(Oliver Reißig) #1

I have a configuration with resolutionStrategy.failOnVersionConflict() and transitive = true and now I add two components:

  • component1 depends on lib version 1.0
  • component2 depends on lib version 1.1

As expected, resolving this configuration fails:

Could not resolve all dependencies for configuration ‘:compile’.
A conflict was found between the following modules:
- com.example:lib:1.0
- com.example:lib:1.1

My problem is: Where do these conflicts come from? This example is extremely obvious, but considering more dependencies with multiple levels of transitive dependencies, it is next to impossible to figure out the root cause for conflicts.

Unfortunately dependencyInsight does not work, because it also tries to resolve the exception, which, of course, fails.

What can I do now?

It would be helpful instead to get a path from the direct dependencies to those transitive ones that conflict in the exception message, e.g.

Could not resolve all dependencies for configuration ‘:compile’.
A conflict was found between the following modules:
- com.example:component1:1 -> com.example:lib:1.0
- com.example:component2:1 -> com.example:lib:1.1


(Stephen Friedrich) #2

I know this is old, but for anybody who got this thread in the search results:
The issues has been addressed (in the next version after gradle 4.8 I suppose), see https://github.com/gradle/gradle/issues/5710

The conflict message is only a bit nicer, but finally dependencyInsight works!