[英]gradle exclude transient dependency from project
In my build.gradle I have the following snipped: 在我的build.gradle中,我有以下内容:
dependencies {
compile project(':utils')
compile (project(':cache')) {
// excludings because of dropwizard conflicts
exclude group: 'org.glassfish.jersey.core'
exclude group: 'javax.ws.rs'
exclude group: 'com.codahale.metrics'
}
but in fact the artifacts are not excluded I still end up with different jersey and metrics in my classpath. 但是实际上并没有排除这些工件,但我最终还是在类路径中使用了不同的球衣和指标。 Ony if I put this in my cache/build.gradle it will compile and run. 如果我将其放在我的cache / build.gradle中,它将编译并运行。
configurations {
all*.exclude group: 'com.codahale.metrics'
all*.exclude group: 'org.glassfish.jersey.core'
}
But then my cache project is broken because of missing dependencies which is not what I wanted. 但是然后我的缓存项目由于缺少依赖项而被破坏,这不是我想要的。
I've had issues with this in the past, what worked was when I included module:
explicitly along with the group. 过去我对此有疑问,什么是可行的,是当我包含module:
与该小组一起明确地。 like so: 像这样:
exclude group: 'commons-math3', module: 'commons-math3'
If you use configurations to exclude, you don't have to do it on all*, you can do it on just local project compile as : 如果使用配置来排除,则不必全部执行*,您可以仅在本地项目编译时执行,如下所示:
compile.exclude group: 'commons-math3', module: 'commons-math3'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.