Gradle didn't respect order of dependencies in maven pom which cause ignoring some excludes


(Vaclav Henrych) #1

Hi, with pom

https://gist.github.com/anonymous/30e103cc03ecc44996da

, gradle didn’t exclude libs correctly - jline is included.

I suppose it is because org.apache.zookeeper:zookeeper:3.4.6 is in transitive dependency of two dependencies - org.apache.curator:curator-client:2.5.0 and org.apache.curator:curator-recipes:2.5.0 - and excludes are only on first of them in pom.xml. Maven evaluates dependencies in order of apperance in pom.xml, so it works.

mvn output:

[INFO] org.gradle.test-exclude:test-exclude:pom:1.0
[INFO] +- org.apache.curator:curator-framework:jar:2.5.0:compile
[INFO] |
+- org.apache.curator:curator-client:jar:2.5.0:compile
[INFO] |
|
\- org.slf4j:slf4j-api:jar:1.7.6:compile
[INFO] |
+- org.apache.zookeeper:zookeeper:jar:3.4.6:compile
[INFO] |
|
\- org.slf4j:slf4j-log4j12:jar:1.6.1:compile
[INFO] |
\- com.google.guava:guava:jar:16.0.1:compile
[INFO] +- io.netty:netty:jar:3.9.0.Final:compile
[INFO] \- org.apache.curator:curator-recipes:jar:2.5.0:compile

gradle output:

\--- org.gradle.test-exclude:test-exclude:1.0
     +--- org.apache.curator:curator-framework:2.5.0
     |
  +--- org.apache.curator:curator-client:2.5.0
     |
  |
  +--- org.slf4j:slf4j-api:1.7.6
     |
  |
  +--- org.apache.zookeeper:zookeeper:3.4.6
     |
  |
  |
  +--- org.slf4j:slf4j-api:1.6.1 -> 1.7.6
     |
  |
  |
  +--- org.slf4j:slf4j-log4j12:1.6.1
     |
  |
  |
  |
  +--- org.slf4j:slf4j-api:1.6.1 -> 1.7.6
     |
  |
  |
  |
  \--- log4j:log4j:1.2.16
     |
  |
  |
  +--- log4j:log4j:1.2.16
     |
  |
  |
  +--- jline:jline:0.9.94
     |
  |
  |
  \--- io.netty:netty:3.7.0.Final -> 3.9.0.Final
     |
  |
  \--- com.google.guava:guava:16.0.1
     |
  +--- org.apache.zookeeper:zookeeper:3.4.6 (*)
     |
  \--- com.google.guava:guava:16.0.1
     +--- io.netty:netty:3.9.0.Final
     \--- org.apache.curator:curator-recipes:2.5.0
          +--- org.apache.curator:curator-framework:2.5.0 (*)
          +--- org.apache.zookeeper:zookeeper:3.4.6 (*)
          \--- com.google.guava:guava:16.0.1

gradle -v

------------------------------------------------------------
Gradle 2.0
------------------------------------------------------------
  Build time:
 2014-07-01 07:45:34 UTC
Build number: none
Revision:
   b6ead6fa452dfdadec484059191eb641d817226c
  Groovy:
     2.3.3
Ant:
        Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:
        1.7.0_51 (Oracle Corporation 24.51-b03)
OS:
         Mac OS X 10.9.4 x86_64

(Vaclav Henrych) #2

Additional note: I did work around by explicit exclude unwanted ones in gradle build, but it should not be needed.