Exclude dependency usage when multiple dependencies are used with string syntax


(suman jakkula) #1

i want to exclude a specific module for a group of dependencies. But below syntax is not working. Am forced to declare multiple compile dependencies each time adding exclude for them. Can I modify the below syntax to something else to make it work?

compile(
                "group1:module1:version1",
                "group1:module2:version2",
                "group1:module3:version3"
        ) {
            exclude module: 'notrequiredModule'
        }

(Luke Daley) #2

Simplest way is to put it in a loop:

["group1:module1:version1", "group1:module2:version2", "group1:module3:version3"].each {
  compile(it) {
    exclude module: 'notrequiredModule'
  }
}