shadow
shadow copied to clipboard
A way to include/exclude an entire configuration
Would it be possible to support inclusion/exclusion of an entire configuration? For example, I have the following solution right now:
configurations.provided.allDependencies.each { dep ->
shadowJar {
dependencies {
exclude(dependency(dep))
}
}
}
A nice solution would be:
shadowJar {
dependencies {
exclude(configurations.provided)
}
}
In my opinion this feature might be also useful for other different jar types (for example, modular projects that has different configurations for different libraries to include).
Nevermind, actually I can make another shadowjar task like this:
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
task customJar(type: ShadowJar) {
configurations = [project.configurations.customConfiguration]
//include customConfiguration in the customJar
}
And:
shadowJar { dependencies { exclude(configurations.provided) } }
Should be the best way of exclusion.
Inclusion/Exclusion beyond a single specific dependency is not really possible right now. It's something I'm thinking about for v2. The biggest issue is how to handle transitive dependencies. If you have Dep. A and Dep B and both have a dependency to C. Then when you exclude Dep B, what should happen? Does C get excluded or does it remain because of A? Etc, etc. There's many variations of this to consider. Because of that complexity, I decided to not support it currently.
This is basically a duplicate of https://github.com/johnrengelman/shadow/issues/159.
@johnrengelman any update on this?