我有问题从sbt版本0.13.2-M3移动到0.13.5-RC3,其中13.2-M3成功解决的传递依赖性无法通过0.13.5-RC3解决。
我得到了未解决的依赖错误,其中版本是“working @”。
当我有一个包含两个子项目的多项目构建时,就会发生这种情况,其中一个子项目取决于另一个子项目。他们都有依赖关系,其maven poms指定一个共同的父母(虽然我不确定这是否是一个红鲱鱼)。
它只发生在依赖项尚未在本地常春藤缓存中。
最小的repro Build是:
import sbt._
import Keys._
object BarBuild extends Build {
val buildSettings = Seq(scalaVersion := "2.10.3")
lazy val root = Project(
id = "bar",
base = file(".")
) aggregate(withSolrCore, withSolrClient)
lazy val withSolrCore = Project(
id = "withSolrCore",
base = file("solrCore"),
settings = buildSettings ++ Seq(
libraryDependencies ++= Seq("org.apache.solr" % "solr-core" % "4.7.1")
)
) dependsOn (withSolrClient)
lazy val withSolrClient = Project(
id = "withSolrClient",
base = file("solrClient"),
settings = buildSettings ++ Seq(
libraryDependencies ++= Seq("org.apache.solr" % "solr-solrj" % "4.7.1")
)
)
}
随着build.properties
的sbt.version=0.13.5-RC3
,我看到很多错误
[warn] module not found: org.apache.lucene#lucene-analyzers-kuromoji;[email protected]
和
[error] unresolved dependency: org.apache.lucene#lucene-core;[email protected]: not found
但随着sbt.version=0.13.2-M3
一切都很好。
我不确定我做错了什么或者某些事情,但是在这一点上我怀疑后者。
谢谢。
这是一个已知的常春藤问题。解决方法是覆盖完全传递闭包中的所有依赖项的版本,这些版本打破了要使用的“真实”版本。 (我通过在存根项目上运行更新来获得真实的,只有问题依赖于sbt的旧版本,0.13.2,这是pre-ivy-bug),比如,
dependencyOverrides ++= Set(
"com.google.guava" % "guava" % "14.0.1",
"com.google.protobuf" % "protobuf-java" % "2.5.0",
"com.googlecode.concurrentlinkedhashmap" % "concurrentlinkedhashmap-lru" % "1.2",
"com.spatial4j" % "spatial4j" % "0.4.1",
...
)