事后如何从 Gradle 依赖列表中排除?
How can I exclude from Gradle dependency lists after the fact?
这是针对大型构建的 Maven 到 Gradle 构建转换。想想 Rodan、Ghidora、Godzilla 等。是的。那么大。
给出如下所示的依赖项:
ext.jbossBom = [ ... ]// This is in the root project.
compile (rootProject.ext.jbossBom) //This is not in the root project
如何从上面排除项目?我试过以下变体:
compile (rootProject.ext.jbossBom) {
exclude group: "some.group", module: "some.module"
}
jbossBom
是一个合集。删除您要删除的元素:
compile (rootProject.ext.jbossBom.findAll{ !it.startsWith('some.group')})
要全局排除某个传递依赖(不管是哪个依赖引入的),你可以这样做:
configurations {
compile.exclude group: 'commons-math3', module: 'commons-math3'
compile.exclude group: 'commons-pool2', module: 'commons-pool2'
}
要从 jbossBom
的每个内容中排除特定的传递依赖,您可以这样做:
dependencies{
jbossBom.each{
compile (it){exclude group:'foo', module:'bar'}
}
}
这是针对大型构建的 Maven 到 Gradle 构建转换。想想 Rodan、Ghidora、Godzilla 等。是的。那么大。
给出如下所示的依赖项:
ext.jbossBom = [ ... ]// This is in the root project.
compile (rootProject.ext.jbossBom) //This is not in the root project
如何从上面排除项目?我试过以下变体:
compile (rootProject.ext.jbossBom) {
exclude group: "some.group", module: "some.module"
}
jbossBom
是一个合集。删除您要删除的元素:
compile (rootProject.ext.jbossBom.findAll{ !it.startsWith('some.group')})
要全局排除某个传递依赖(不管是哪个依赖引入的),你可以这样做:
configurations {
compile.exclude group: 'commons-math3', module: 'commons-math3'
compile.exclude group: 'commons-pool2', module: 'commons-pool2'
}
要从 jbossBom
的每个内容中排除特定的传递依赖,您可以这样做:
dependencies{
jbossBom.each{
compile (it){exclude group:'foo', module:'bar'}
}
}