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

徘徊边缘 提交于 2019-12-11 04:48:59

问题


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.


回答1:


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

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

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

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

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



来源:https://stackoverflow.com/questions/55441430/what-does-this-all-exclude-means-in-gradle-transitive-dependency

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!