kordamp / enforcer-gradle-plugin

Kordamp Enforcer Gradle Plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DependencyConvergence plugin fails, yet :dependencyInsight doesn't provide additional insight

flangknecht opened this issue · comments

We've just added the DependencyConvergence enforcer rule to our project.
Now it fails due to dependencies not converging (good so far).
Trying to get insights into dependency resolution by running ./gradlew :neo-autoconfigure:dependencyInsight --configuration compileClasspath --dependency org.springframework.boot:spring-boot-autoconfigure

yields

* What went wrong:
A problem occurred configuring project ':neo-autoconfigure'.
> Could not resolve all dependencies for configuration ':neo-autoconfigure:compileClasspath'.
   > Conflict(s) found for the following module(s):
       - org.springframework.boot:spring-boot-autoconfigure between versions 2.3.1.RELEASE and 2.0.0.RELEASE
       - org.slf4j:slf4j-api between versions 1.7.30 and 1.7.25
       - org.springframework.boot:spring-boot between versions 2.3.1.RELEASE and 2.0.0.RELEASE
     Run with:
         --scan or
         :neo-autoconfigure:dependencyInsight --configuration compileClasspath --dependency org.springframework.boot:spring-boot-autoconfigure
     to get more insight on how to solve the conflict.

This instructs me to run gradle with the same command line I used above, not providing any further insight.

Running it with -Denforcer.enabled=false, we get the desired dependency resolution output.

We have the plugin configured like follows:

rule<DependencyConvergence> {
                enabled.set(true)
                failOnDynamicVersions.set(true)
                failOnChangingVersions.set(true)
            }

Yes, this is a tough one as the error that appears in the console does not come from the enforcer but from Gradle when it resolves configurations. As such, there's no way the enforcer plugin can add an extra line to instruct users to skip the enforcer rule, as you have done.