GradleUp / shadow

Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries. Gradle version of Maven's Shade plugin.
https://www.gradleup.com/shadow/
Apache License 2.0
3.7k stars 392 forks source link

shadowJar task reports UP-TO-DATE with normal exclude. #62

Open Grinch opened 10 years ago

Grinch commented 10 years ago

Similar to the issue with #54, when I add an exclude option to the shadowJar block it doesn't update my JAR appropriately. The below code doesn't update my jar when the shaders folder is present on the root of it.

shadowJar {
    classifier = ''
    destinationDir = file("build/distributions")
    dependencies {
        include(dependency('org.obsidianbox.magma:magma:1.0.0-SNAPSHOT'))
        include(dependency('org.spout:caustic-api:1.0.0-SNAPSHOT'))
        include(dependency('org.spout:caustic-lwjgl:1.0.0-SNAPSHOT'))
    }
    exclude 'shaders/'
}
johnrengelman commented 10 years ago

hmm, yeah...this is going to be a tough one. The problem here is that the contents of the jars themselves aren't actually included in the source from the perspective of AbstractCopyTask. So i'll probably need to add a new property to track these things, but I'll need to do it in an efficient manner.

Grinch commented 10 years ago

No worries, it isn't too critical for me at the moment so whenever you can come upon a suitable fix is fine. :) Just waiting on 2.0 compatibility for the moment. ;)

autonomousapps commented 3 years ago

I just ran into this with 7.0.0. I wanted to exclude some Kotlin cruft, so I added

shadowJar.exclude '**/*.kotlin_metadata'

and it didn't seem to be doing anything, till I deleted the jar and reran the shadowJar task. Then I could see my exclude worked. I have resorted to using shadowJar.outputs.upToDateWhen { false }. I'm actually not sure if this is more properly a Gradle bug, since exclude is a function on AbstractCoptyTask.