Duplicate Jars in Zip Output w/ Gradle 2.0+

I found a build output change when moving to Gradle 2.0. I wonder if this is the expected behavior?

apply plugin: 'compare-gradle-builds'
apply plugin: 'base'
  repositories { mavenCentral() }
dependencies { archives 'axis:axis:1.4' }
  task distribution(type:Zip) { from configurations.archives }
artifacts { archives distribution }
  compareGradleBuilds {
    sourceBuild { gradleVersion "1.12" }
    targetBuild { gradleVersion "2.0"
}
}

The comparison task says the build is identical …

$ gradle clean compare
Configuration on demand is an incubating feature.
:clean
:compareGradleBuilds
Tooling API is using target Gradle version: 1.12.
Connected to the daemon. Dispatching Build{id=c4336b9c-c525-4fbd-9732-3a432a4eb475.1, currentDir=/home/pcm/Akimeka/gradle-bugs/axis} request.
Configuration on demand is an incubating feature.
:clean
:distribution
:assemble
  BUILD SUCCESSFUL
  Total time: 0.558 secs
Tooling API is using target Gradle version: 2.0.
Connected to the daemon. Dispatching Build{id=998db787-2165-4318-9837-ef8ab17441ea.1, currentDir=/home/pcm/Akimeka/gradle-bugs/axis} request.
Configuration on demand is an incubating feature.
:clean
:distribution
:assemble
  BUILD SUCCESSFUL
  Total time: 0.415 secs
  BUILD SUCCESSFUL
  Total time: 2.188 secs

Further investigation …

$ unzip -t ./build/reports/compareGradleBuilds/files/source/_distribution/axis.zip
Archive:
./build/reports/compareGradleBuilds/files/source/_distribution/axis.zip
    testing: axis-1.4.jar
           OK
    testing: axis-wsdl4j-1.5.1.jar
  OK
    testing: commons-logging-1.0.4.jar
 OK
    testing: commons-discovery-0.2.jar
 OK
    testing: axis-jaxrpc-1.4.jar
    OK
    testing: axis-saaj-1.4.jar
      OK
No errors detected in compressed data of ./build/reports/compareGradleBuilds/files/source/_distribution/axis.zip.
$ unzip -t ./build/reports/compareGradleBuilds/files/target/_distribution/axis.zip
Archive:
./build/reports/compareGradleBuilds/files/target/_distribution/axis.zip
    testing: axis-1.4.jar
           OK
    testing: axis-jaxrpc-1.4.jar
    OK
    testing: axis-saaj-1.4.jar
      OK
    testing: axis-wsdl4j-1.5.1.jar
  OK
    testing: commons-logging-1.0.4.jar
 OK
    testing: commons-discovery-0.2.jar
 OK
    testing: axis-jaxrpc-1.4.jar
    OK
    testing: axis-saaj-1.4.jar
      OK
No errors detected in compressed data of ./build/reports/compareGradleBuilds/files/target/_distribution/axis.zip.

Whoops … the target zip has duplicates of jaxrpc and saaj?

I am experiencing this issue also. Have you had any luck getting to the bottom of it?

Hi Casey, Chad

Set the DuplicatesStrategy to EXCLUDE in your copy spec on your distribution task

 task distribution(type:Zip) {

from configurations.archives

duplicatesStrategy DuplicatesStrategy.EXCLUDE }

Kon,

I’ve done that in few places, but seriously I think this is a regression that should be fixed. I have other tasks where I’ve already set the dulipcateStrategy to something else. It looks like that POMs with a relocation value are now resolving to the relocated JAR, but the relocated POM is also part of the dependency set.