在我的头撞到https://github.com/google/guice/issues/846一个多小时后,我意识到我有两个不同的 jar 提供的 Guice 库:guice-4.0-beta5.jar 和 sisu-guice -3.1.3-no_aop.jar。
呸……
第二个与Guava 18不兼容,如果加载,使用Guava时会导致访问错误。
我正在创建一个没有依赖项的 SBT 插件,但由sbtPlugin := true
.
依赖树(我的插件是com.github.pauldraper.playclosure:sbt-plugin
):
> what-depends-on org.sonatype.sisu sisu-guice 3.1.3
[info] org.sonatype.sisu:sisu-guice:3.1.3
[info] +-org.eclipse.sisu:org.eclipse.sisu.plexus:0.0.0.M5
[info] +-org.apache.maven:maven-core:3.2.2
[info] | +-org.vafer:jdeb:1.3
[info] | +-com.typesafe.sbt:sbt-native-packager:0.7.4
[info] | +-com.typesafe.play:sbt-plugin:2.3.7
[info] | +-com.github.pauldraper.playclosure:sbt-plugin:0.0-SNAPSHOT
[info] | | +-default:project_2.10:0.1-SNAPSHOT [S]
[info] | |
[info] | +-default:project_2.10:0.1-SNAPSHOT [S]
[info] |
[info] +-org.apache.maven:maven-plugin-api:3.2.2
[info] +-org.apache.maven:maven-core:3.2.2
[info] | +-org.vafer:jdeb:1.3
[info] | +-com.typesafe.sbt:sbt-native-packager:0.7.4
[info] | +-com.typesafe.play:sbt-plugin:2.3.7
[info] | +-com.github.pauldraper.playclosure:sbt-plugin:0.0-SNAPSHOT
[info] | | +-default:project_2.10:0.1-SNAPSHOT [S]
[info] | |
[info] | +-default:project_2.10:0.1-SNAPSHOT [S]
[info] |
[info] +-org.vafer:jdeb:1.3
[info] +-com.typesafe.sbt:sbt-native-packager:0.7.4
[info] +-com.typesafe.play:sbt-plugin:2.3.7
[info] +-com.github.pauldraper.playclosure:sbt-plugin:0.0-SNAPSHOT
[info] | +-default:project_2.10:0.1-SNAPSHOT [S]
[info] |
[info] +-default:project_2.10:0.1-SNAPSHOT [S]
[info]
所以这种可怕的依赖是通过传递而来的sbt-plugin
。
理想情况下,我不必要求插件的最终用户使用排除项。
我怎样才能让我的插件排除这种依赖关系,并且不会产生这个问题?