2015-10-13 48 views
0

我已經被授權將舊的ant構建腳本重寫爲SBT。碰巧,我們的套件由3個模塊組成:多項目SBT構建不良符號參考標量反射運行時

  • A Play 2.3前端Web服務器;
  • 用於從各種其他系統檢索數據的後端;
  • 一箇中間模塊,包含一些用於數據庫訪問和業務邏輯的共享類。

下面我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.

的源代碼按以下結構組織:

  • 返回
    • SRC
    • 測試
    • LIB
  • 中間
    • SRC
    • 測試
    • LIB
    • SRC
    • 測試
    • LIB

這裏,每個lib文件夾中包含了一些手動維護庫(這就是爲什麼我們要移動到SBT)。

關於如何解決這個問題的任何想法?

+0

你是否聲明scala-reflect是一個庫依賴項? –

+1

你使用Scala 2.11.1而不是2.11.7的任何原因? 'ValueConverter'從哪裏來 - 它是手動維護的庫之一嗎?可能它是針對像2.10這樣的舊版Scala版本編譯的?這裏的關鍵不是'缺少scala.reflect.runtime'(正如你的標題所示),而是**不好的符號參考** –

+0

我試圖添加反映作爲依賴項,但不幸的是,這並沒有幫助。 – irundaia

回答

0

最後,我放棄了試圖讓編譯器理解其他庫。最後,我將那些使用sbt的依賴關係添加到sbt託管庫中。這顯然運作良好。