这不是重复的,因为这些其他解决方案不起作用。如何排除从其他子项目引入的依赖关系?
我有一个子项目:
:公地:小部件
gradle.build(子项目)类似于此:
configurations {providedCompile}
dependencies {
compile project(":commons:other-widget")
...other dependencies...
}
如果显示的依赖关系:
+--- project :commons:some-other-project
+--- project :commons:exclude-me-project (*)
\--- org.apache.cxf:cxf-rt-frontend-jaxrs: -> 3.0.3 (*)
什么不起作用:
任何常用语法。我试过了我能想到的所有变化。甚至去寻找API,但无法找到我需要的。
在这个项目的依赖部分: ...
compile project(":commons:some-other-project") {
exclude (":commons:exclude-me-project")
}
结果:
Could not find method exclude() for arguments [:commons:some-other-project] on project
我也试过:
compile (project (':commons:some-other-project')) {
transitive = false
}
结果:除删除的依赖“:commons:some-other-project”,它删除了“:commons:some-other-project”。
我有一个大而复杂的项目进行转换。我有很多这样的工作在我面前。如果将项目视为依赖项,我该如何排除它?
你试过'排除(“groupID:ModuleID”)'? – RaGe
或者'transitive = false' – RaGe
Re:transitive = false如果你想排除一切事情,那么在子项目和尝试重用东西方面没什么意义。我需要特定的东西。 – user447607