1

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?

mandelbug
  • 1,548
  • 5
  • 20
  • 32
  • 1
    Would [merging the files](https://imperceptiblethoughts.com/shadow/configuration/merging/#appending-xml-files) do the trick? – dnault Feb 06 '20 at 02:59
  • In this case no – mandelbug Feb 06 '20 at 10:47
  • I take that back. I didn't see that there was an XML specific method. I tried just `append` before and that didn't work. Using the `XmlAppendingTransformer` on it did the trick. Still would be nice if you could just include duplicates though. – mandelbug Feb 06 '20 at 12:52
  • I used `com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer` to append `reference.conf` files. It does merge the `reference.conf` file by creates a bunch of duplicates for other files like `applicatin.conf`. Any Idea on how to fix that? – Pubudu Sitinamaluwa Aug 06 '20 at 12:07
  • Okay found the issue. adding `with jar` at the end made it bundle the same thing twice. – Pubudu Sitinamaluwa Aug 06 '20 at 12:39

0 Answers0