1

I came across Gradle Groovy DSL snippet like below:

configurations {
  all*.exclude group:'org.apache.hadoop', module:'hadoop-core'
}

The all*.exclude confused me totally. Is the above block equivalent to below?

configurations {
  all {
    exclude group:'org.apache.hadoop', module:'hadoop-core'
  }
}

Also, is there a reference that explains the all*.exclude syntax?

Thanks.

JBT
  • 8,498
  • 18
  • 65
  • 104

2 Answers2

2

The result is indeed the same.

all is a property containing a list with all the configuration objects. The *. part is Groovy syntax, meaning "execute the action on each element of the list". It's called spread operator.

The same question has been asked here.

Thomas Vitale
  • 1,588
  • 10
  • 13
0

We can exclude transitive dependencies easily from specific configurations. To exclude them from all configurations we can use Groovy's spread-dot operator and invoke the exclude() method on each configuration. We can only define the group, module or both as arguments for the exclude() method.

configurations {
all*.exclude group:'org.apache.hadoop', module:'hadoop-core'

}

Equivalent to :

configurations {
all.collect { configuration ->
    configuration.exclude group: 'org.apache.hadoop', module: 'hadoop-core'
}

}