Please notice, that the group of the primary dependency and the exclude group are the same. Basically, we want to say include this dependency but exclude all other dependencies of the same group.
Once upgraded to Gradle 2.3 RC3, this does not work anymore. Instead EVERYTHING from that group is excluded, INCLUDING the primary dependency. In order to fix this I have to declare:
What is the reason for the changed behavior? Is it possibly a bug? I could see both sides of the coin here. However, it is more wordy. Is there another workaround?
This looks to have been an unintentional result of some changes made in 2.3 regarding Ivy module exclusions. The current plan is to revert back to the old behavior and put out another release candidate. Please look out for RC4 and try your build again.
In the 2.3 release version, this appears to still be an issue. I’m getting full exclusion of not just transitive dependencies, but the primary itself.
compile (‘com.mycompany:MyCompanyJar:1.0’) {
exclude module: ‘*’ }
Doing this, MyCompanyJar is not added to the classpath/pulled from our repo. The behavior in 2.2.1 was to get MyCompanyJar but not its dependencies. Is this a bug or a new definition of how it should work?
Dug a little more and I believe this might (somehow) be an Eclipse problem. Using your suggestion
transitive false
Provides the correct jars when running task distZip from either the command line or through Eclipse. Changing this to
exclude module: ‘*’
will produce an identical result running distZip on the command line, but will miss the jar when running distZip from Eclipse.
I don’t have much of an understanding how the Eclipse plug-in works with Gradle and this seems really bizarre to me. Let me know if I can provide something else to you.