5

I wonder what does "all*.exclude" mean in Gradle transitive dependency ?

configurations {
        compile.exclude group: 'org.hamcrest', module: 'hamcrest-core'
        all*.exclude group: 'org.mockito', module: 'mockito-all'
    }

Is "all*.exclude" in the code above syntax of Gradle or some else.

wei ye
  • 73
  • 1
  • 7

1 Answers1

6

In this context, all*. refers to all configurations ...

and it applies exclude group: 'org.mockito', module: 'mockito-all' to all of them.

The all*. syntax is the short-handed notation of:

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

The *. syntax is called "spread-dot operator", which is a Groovy syntax (see paragraph 8.1).

Martin Zeitler
  • 1
  • 19
  • 155
  • 216