Announcement Announcement Module
Collapse
No announcement yet.
Gradle plugin does not resolve dependencies using default strategy Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Gradle plugin does not resolve dependencies using default strategy

    I believe that the plugin does not behave correctly regarding dependencies resolution. I'm expecting it to use latest version of a library with the same name, but it is pulling one from upstream (previous version).
    To confirm that I have created a multi-project with two projects and master. I'm using third party library as an example. EntityUtils.consumeQuietly() was introduced in 4.2 version of httpcore and is not available in 4.1.x.

    I'm using latest version of plugin and tried with both, 1.3 and 1.4-rc-2 versions of Gradle.

    master/settings.gradle
    Code:
    includeFlat 'foo', 'bar'
    master/build.gradle
    Code:
    subprojects {
        apply plugin: 'java'
        repositories {
            mavenCentral()
        }
    }
    foo/build.gradle
    Code:
    dependencies {
        compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.1.3'
    }
    bar/build.gradle
    Code:
    dependencies {
        compile project(':foo')
        compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.2.1'
    }
    bar/src/main/java/HelloWorld.java
    Code:
    import org.apache.http.util.EntityUtils;
    
    public class HelloWorld {
        public static void main(String[] args) throws Exception {
            EntityUtils.consumeQuietly(null);
        }
    }
    But I can build the project with Gradle command line without any issues and it reports proper dependencies.
    Code:
    andrey-mbp:bar andrey$ gradle dependencies
    :bar:dependencies
    
    ------------------------------------------------------------
    Project :bar
    ------------------------------------------------------------
    
    archives - Configuration for archive artifacts.
    No dependencies
    
    compile - Classpath for compiling the main sources.
    +--- master:foo:unspecified
    |    \--- org.apache.httpcomponents:httpcore:4.1.3 -> 4.2.1
    \--- org.apache.httpcomponents:httpcore:4.2.1
    
    default - Configuration for default artifacts.
    +--- master:foo:unspecified
    |    \--- org.apache.httpcomponents:httpcore:4.1.3 -> 4.2.1
    \--- org.apache.httpcomponents:httpcore:4.2.1
    
    runtime - Classpath for running the compiled main classes.
    +--- master:foo:unspecified
    |    \--- org.apache.httpcomponents:httpcore:4.1.3 -> 4.2.1
    \--- org.apache.httpcomponents:httpcore:4.2.1
    
    testCompile - Classpath for compiling the test sources.
    +--- master:foo:unspecified
    |    \--- org.apache.httpcomponents:httpcore:4.1.3 -> 4.2.1
    \--- org.apache.httpcomponents:httpcore:4.2.1
    
    testRuntime - Classpath for running the compiled test classes.
    +--- master:foo:unspecified
    |    \--- org.apache.httpcomponents:httpcore:4.1.3 -> 4.2.1
    \--- org.apache.httpcomponents:httpcore:4.2.1
    
    (*) - dependencies omitted (listed previously)
    
    BUILD SUCCESSFUL
    
    Total time: 1.115 secs
    NB: Same problem with IntelliJ IDEA, so I'm suspecting there might be something on Gradle tooling side, although their command line process works flawlessly.

  • #2
    Relevant discussion with IntelliJ IDEA guys:
    http://youtrack.jetbrains.com/issue/IDEA-99640

    Post on Gradle forum:
    http://forums.gradle.org/gradle/topi...fault_strategy

    Comment


    • #3
      Looks like a bug in Gradle:
      http://issues.gradle.org/browse/GRADLE-2652

      Comment


      • #4
        Thanks for all the infos. It looks like nothing more for me to add. You already nailed it down to it being a Gradle bug.

        Kris

        Comment

        Working...
        X