[Gradle] Exclusion of transitive dependency from other sub-project not excluded

I have a multi build gradle setup with the following dependency structure:

root
|
+--- moduleA
+--- org.springframework:spring-beans:3.1.4.RELEASE
|    \--- org.springframework:spring-core:3.1.4.RELEASE
|         +--- org.springframework:spring-asm:3.1.4.RELEASE
|         \--- commons-logging:commons-logging:1.1.1
\--- project :moduleB
|
|
\--- moduleB
\--- org.springframework:spring-beans:1.2.8
     +--- org.springframework:spring-core:1.2.8
     |    +--- commons-logging:commons-logging:1.0.4
     |    \--- commons-collections:commons-collections:3.1
     \--- commons-logging:commons-logging:1.0.4

Basically

moduleA
depends on Spring 3 meanwhile moduleB depends on Spring 1.2.8.
Also moduleA depends on module B and excludes the dependency org.springframework (which is transitive for
moduleB
).

The gradle configuration for moduleA is:
dependencies {
    compile "org.springframework:spring-beans:3.1.4.RELEASE"
    
compile (project(":moduleB")) {
        exclude group: "org.springframework"
    
}
}


The gradle configuration for moduleB is:

dependencies {
    compile "org.springframework:spring-beans:1.2.8"
}


Using the gradle command line for displaying the dependencies I can confirm that Spring 1.2.8 is being excluded correctly from the point of view of moduleA.
Now when working in IntellJ Idea this does not happen. The moduleA has in its classpath Spring 1.2.8 which it causes compile issues.

What I have tried:

  • If I remove the dependency and invalidate the cache, then everything is fine.
  • If I edit manually the "moduleA.iml" and I moved the orderEntry node for the moduleB to the last postion, then everything is fine too.


I have set up a small project with this structure that I have attached if anyone fancy to play with.



Attachment(s):
intellj_Issue.tar.gz
3 comments
Comment actions Permalink

this is a known limitation issue of the current gradle integration in IDEA. You can find more details and track the issue at https://youtrack.jetbrains.com/issue/IDEA-125971

0
Comment actions Permalink

Thank you @Vladislav Soroka!
I haven't found it earlier, my fault.

Glad to know that there is a issue for it, do we have an estimation for when it is going to be fixed?

Thanks

0
Comment actions Permalink

the fix is planned for v15, and it's expected to have something to try in one of the first IDEA 15 EAP builds.

0

Please sign in to leave a comment.