我可以排除嵌套依赖吗?

时间:2015-01-17 00:58:04

标签: scala maven sbt ivy

是否可以排除嵌套依赖项?考虑以下依赖关系:

[info]   +-org.apache.ws.commons.axiom:axiom-dom:1.2.13
[info]   | +-commons-logging:commons-logging:1.1.1
[info]   | +-org.apache.geronimo.specs:geronimo-activation_1.1_spec:1.1
[info]   | +-org.apache.geronimo.specs:geronimo-javamail_1.4_spec:1.7.1
[info]   | +-org.apache.ws.commons.axiom:axiom-api:1.2.13
[info]   | | +-commons-logging:commons-logging:1.1.1
[info]   | | +-jaxen:jaxen:1.1.3
[info]   | | +-org.apache.geronimo.specs:geronimo-activation_1.1_spec:1.1
[info]   | | +-org.apache.geronimo.specs:geronimo-javamail_1.4_spec:1.7.1
[info]   | | +-org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:1.0.1
[info]   | | +-org.apache.james:apache-mime4j-core:0.7.2

我想排除org.apache.geronimo.specs:geronimo-stax-api_1.0_spec

以下是我在build.scala

中尝试过的内容
"org.apache.ws.commons.axiom" % "axiom-dom" % axiomVersion excludeAll ExclusionRule(organization = "org.apache.geronimo.specs", name = "geronimo-stax-api_1.0_spec"),

哪个不起作用。我想另一种选择是使axiom-dom不敏感,但它需要我手动指定所有剩余的依赖,这是不冷却的。

1 个答案:

答案 0 :(得分:0)

根据SBT manual,你必须将ExclusionRule包装成exclude函数。像这样:

"org.apache.ws.commons.axiom" % "axiom-dom" % axiomVersion excludeAll(ExclusionRule(organization = "org.apache.geronimo.specs", name = "geronimo-stax-api_1.0_spec"))

"org.apache.ws.commons.axiom" % "axiom-dom" % axiomVersion exclude("org.apache.geronimo.specs", "geronimo-stax-api_1.0_spec")