shadow icon indicating copy to clipboard operation
shadow copied to clipboard

A way to include/exclude an entire configuration

Open levsa opened this issue 9 years ago • 5 comments

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)
    }
}

levsa avatar Jan 08 '16 08:01 levsa

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).

liach avatar Mar 16 '16 01:03 liach

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.

liach avatar Mar 16 '16 15:03 liach

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.

johnrengelman avatar Mar 16 '16 16:03 johnrengelman

This is basically a duplicate of https://github.com/johnrengelman/shadow/issues/159.

johnrengelman avatar Mar 16 '16 16:03 johnrengelman

@johnrengelman any update on this?

DevSrSouza avatar Sep 11 '20 19:09 DevSrSouza