I have one simple project with two modules and master. I can build it with Gradle and dependencies report shows all proper data. Yet when I’m importing the project into IntelliJ or Eclipse, it does not compile.
Here’s what I see in Eclipse and in IntelliJ:
Expected foo -> 4.1.3 bar -> 4.2.1
Actual foo -> 4.1.3 bar -> 4.1.3
While I understand, that this issue cannot be addressed directly to Gradle, I would like to mention, that both, Eclipse STS and IntelliJ Gradle plugin do not recognize 4.2.1 version as the proper one. Which makes me think that either those plugins are not using tooling kit properly or there’s something wrong with the tooling kit. Any ideas?
master _build.gradle
subprojects {
apply plugin: 'java'
repositories {
mavenCentral()
}
}
master _settings.gradle
includeFlat 'foo', 'bar'
foo _build.gradle
dependencies {
compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.1.3'
}
bar _build.gradle
dependencies {
compile project(':foo')
compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.2.1'
}
_src/main/java/HelloWorld.java
import org.apache.http.util.EntityUtils;
public class HelloWorld {
public static void main(String[] args) throws Exception {
EntityUtils.consumeQuietly(null);
}
}
EntityUtils.consumeQuietly() is the method introduced in 4.2 of httpcore.
Here’s the output from gradle:
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