我们有一个使用 scala-actors 2.10.x 的内部库。它在它的 build.sbt 中有这个
libraryDependencies <++= scalaVersion(v =>
Seq("org.scala-lang" % "scala-actors" % v)
)
该库仅使用 2.10.0 编译并推送到我们的内部 Maven 存储库。
我们依赖库的项目之一已更新到 2.10.1。依赖项目具有相同的功能libraryDependencies
,因此现在编译依赖项目会发出警告:
$ sbt
[info] Loading project definition from /tmp/foo/project
[info] Set current project to bar (in build file:/tmp/foo/)
[warn] Potentially incompatible versions of dependencies of {file:/tmp/foo/}bar:
[warn] org.scala-lang: 2.10.1, 2.10.0
使用依赖 sbt 插件显示了这一点:
[info] +-com.example:ourlibrary_2.10:1.0.1 [S]
[info] | +-org.scala-lang:scala-actors:2.10.0 (evicted by: 2.10.1)
[info] |
[info] +-org.scala-lang:scala-actors:2.10.1 [S]
最好的图书馆应该怎么libraryDependencies
写?我有以下内容,但是有没有更清洁的方法?
libraryDependencies <++= scalaVersion(v =>
{
// Use any version of scala-actors for this version of Scala.
val split = v.split('.')
val major = split(0).toInt
val minor = split(1).toInt
val revision = "[%s.%s,%s.%s)".format(major, minor, major, minor+1)
Seq("org.scala-lang" % "scala-actors" % revision)
}
)