Gradle Shadow Duplicate File Names in Jar

757 Views Asked by At

I'm trying to migrate from an Ant build to a Gradle build. I am using Shadow (com.github.jengelman.gradle.plugins:shadow:5.2.0) to build my project. My project includes 3 Apache Axiom dependencies:

implementation group: 'org.apache.ws.commons.axiom', name: 'axiom-api', version: '1.2.13'
implementation group: 'org.apache.ws.commons.axiom', name: 'axiom-dom', version: '1.2.13'
implementation group: 'org.apache.ws.commons.axiom', name: 'axiom-impl', version: '1.2.13'

The Shadow configuration looks like this:

shadowJar {
    baseName = project.name
    classifier = ''
    archiveVersion = ''
    exclude "META-INF/*.SF"
    exclude "META-INF/*.DSA"
    exclude "META-INF/*.RSA"
}

When these jars are built with my Ant project, I end up with 2 axiom.xml files in META-INF in the jar. Both are different.

Ant axiom.xml

When I build with Shadow I end up with the latter of the two axiom.xml files. The first file is being overwritten by the latter.

Gradle axiom.xml

This causes a runtime error. How can I get Shadow to include files of duplicate files names instead of just overwriting them?

0

There are 0 best solutions below