johnrengelman/shadow — pull request #86 by amorfis (2014-08-20 19:21:56+00:00)
Title: Change names of files with the same path

If there are two files with the same path in two merged .jar files, e.g.

junit-3.8.1.jar: /LICENSE.TXT
hamcrest-1.3.jar: /LICENSE.TXT

don't overwrite one file with another, but include both in shadow jar with changed names:

/LICENSE-junit-3.8.1.TXT
/LICENSE-hamcrest-1.3.TXT

I have some problems with tests, but... when I rewinded back to commit 30a696d16709fa1cdb23a97cd7990e9ea2e46ead (onto which I rebased my changes) or even 43fe9909bc3a74771d9cdcb0f22dc5528a923eb8 (the one that was HEAD when I forked this repository) and issued "./gradlew clean test" I still have the same problems.

It is quite random, and must be connected with classloaders:

Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'org.apache.tools.zip.ZipOutputStream@583d38a9' with class 'org.apache.tools.zip.ZipOutputStream' to class 'org.apache.tools.zip.ZipOutputStream'
at com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction.execute(ShadowCopyAction.groovy:69)