多项目 SBT 构建错误的符号引用 scala-reflect 运行时

Multiproject SBT build bad symbolic reference scala-reflect runtime

我的任务是将旧的 ant 构建脚本重写为 SBT。碰巧,我们的套件由 3 个模块组成:

下面是我的 Build.scala 文件的摘录:

val sharedSettings = Seq(
  organization        := <organization here>,
  version             := "1.2.5",
  scalaVersion        := "2.11.1",
  libraryDependencies ++= libraries,
  unmanagedJars in Compile ++= baseDirectory.value / "lib",
  unmanagedJars in Compile ++= baseDirectory.value / "src",
  unmanagedJars in Compile ++= baseDirectory.value / "test"
)

lazy val middle = project.settings(sharedSettings: _*)
lazy val back = project.settings(sharedSettings: _*).dependsOn(middle)

但是,当我尝试编译源代码时,出现以下错误:

bad symbolic reference to scala.reflect.runtime encountered in class file 'ValueConverter.class'. Cannot access term runtime in package scala.reflect. The current classpath may be missing a definition for scala.reflect.runtime, or ValueConverter.class may have been compiled against a version that's incompatible with the one found on the current classpath.

源代码按以下结构组织:

这里每个 lib 文件夹都包含一些手动维护的库(这就是我们要迁移到 sbt 的原因)。

关于如何解决这个问题有什么想法吗?

最后,我放弃了让编译器理解额外库的尝试。最后,我将那些使用 sbt 可用的依赖项添加到 sbt 管理的库中。这显然效果很好。