gradletransitive-dependency

What does this "all*.exclude" means in Gradle transitive dependency?


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.


Solution

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