免责声明:新的sbt / Scala用户
所以我有以下build.sbt
文件(sbt.version=1.1.1
):
val managedLibs : Setting[_] = libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % "2.11.10" withSources(),
"org.scala-lang" % "scala-library" % "2.11.10" withSources(),
"org.scala-lang" % "scala-reflect" % "2.11.10" withSources()
)
lazy val root = (project in file("."))
.settings(
name := "foo",
organization := "bar",
scalaVersion := "2.12.4",
sourcesInBase := false,
version := "0.1",
managedLibs
)
我想要做的是使用不同的编译器版本来构建我的项目和我的项目中的不同编译器版本(即,作为库)。 Sbt似乎不喜欢这样,我收到以下警告:
[warn] Binary version (2.11) for dependency org.scala-lang#scala-compiler;2.11.10
[warn] in bar#foo_2.12;0.1 differs from Scala binary version in project (2.12).
[warn] Binary version (2.11) for dependency org.scala-lang#scala-library;2.11.10
[warn] in bar#foo_2.12;0.1 differs from Scala binary version in project (2.12).
[warn] Binary version (2.11) for dependency org.scala-lang#scala-reflect;2.11.10
[warn] in bar#foo_2.12;0.1 differs from Scala binary version in project (2.12).
[warn] Multiple dependencies with the same organization/name but different versions. To avoid conflict, pick one version:
[warn] * org.scala-lang:scala-library:(2.12.4, 2.11.10)
我的程序使用scala编译并运行时没有问题2.12.4
(它看起来像sbt忽略2.11.10
)但我只是好奇:是否有可能以这种方式使用不同的版本?这是sbt施加的严格限制吗?
提前感谢您的帮助!