Project dependencies participate in conflict resolution

not-a-bug

(Danny Thomas) #1

Gradle Version: 2.13
Operating System: macOS
Is this a regression? No

If a binary dependency comes into a multiproject build that’s provided by that project (technically a circular dependency, but it happens), the project dependency participates in conflict resolution, so if the version is not greater or specified at all, the binary dependency wins. For example:

apply plugin: 'java'

repositories {
    jcenter()
}

dependencies {
    compile project(':commons-logging')
    compile 'commons-logging:commons-logging:1.2'
}

project(':commons-logging') {
    apply plugin: 'java'

    group 'commons-logging'
    version '1.2'
}

Has the expected behavior:

compile - Dependencies for source set 'main'.
+--- project :commons-logging
\--- commons-logging:commons-logging:1.2 -> project :commons-logging

If you remove the version from the commons-logging subproject:

compile - Dependencies for source set 'main'.
+--- project :commons-logging -> commons-logging:commons-logging:1.2
\--- commons-logging:commons-logging:1.2

The project dependency should always win, in my opinion.


(Mark Vieira) #2

There is an open pull request and corresponding design document for this.