Allow resolutionStrategy to remove dependency


(Dimitar Dimitrov) #1

For example, in plugin builds I would like to be able to do:

allprojects {
    configurations.all {
        resolutionStrategy {
            eachDependency { // skip Groovy artifacts as they are provided by gradleApi()
                if (requested.group == 'org.codehaus.groovy') useTarget null
            }
        }
    }
}

Right now we have a choice to replace the Groovy deps with another irrelevant dependency, or to hunt down the transitives and exclude from each external dependency.


(Schalk Cronjé) #2

I would normally just do something like

dependencies {
  compile 'a:b:1.0', {
    exclude module : 'groovy-all'
  }
}

but this can get overboard if your plugin depends on many other artififacts with groovy in their transitive dependencies, so have tried just doing

configurations.all { exclude module: 'groovy-all' }