2016-03-01 78 views
1

由於我有一些依賴性問題,我決定將我的計算機上的Scala安裝升級到版本2.12.0-M3。我也跑了sbt -v,之後下載了很多軟件包。升級到版本2.12後無法解決依賴關係

然而,當我嘗試刷新以下build.sbt文件

name := """ScalaWeb""" 

version := "1.0-SNAPSHOT" 

lazy val root = (project in file(".")).enablePlugins(PlayScala) 

scalaVersion := "2.12.0-M3" 

libraryDependencies ++= Seq(
    jdbc, 
    cache, 
    ws, 
    specs2 % Test, 
    "org.sorm-framework" % "sorm" % "0.3.18" 
) 

resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases" 

// Play provides two styles of routers, one expects its actions to be injected, the 
// other, legacy style, accesses its actions statically. 
routesGenerator := InjectedRoutesGenerator 

scalacOptions += "-Ylog-classpath" 

我收到以下錯誤:

Error:Unresolved dependencies: 
com.typesafe.play#twirl-api_2.12.0-M3;1.1.1: not found 
com.typesafe.play#play-server_2.12.0-M3;2.4.6: not found 
com.typesafe.play#play-netty-server_2.12.0-M3;2.4.6: not found 
com.typesafe.play#play-jdbc_2.12.0-M3;2.4.6: not found 
com.typesafe.play#play-cache_2.12.0-M3;2.4.6: not found 
com.typesafe.play#play-ws_2.12.0-M3;2.4.6: not found 
com.typesafe.play#play-test_2.12.0-M3;2.4.6: not found 
com.typesafe.play#play-specs2_2.12.0-M3;2.4.6: not found 
com.typesafe.play#play-omnidoc_2.12.0-M3;2.4.6: not found 

版本2-12.0-M3出現在2015年10月,它似乎令人懷疑,所有這些包仍然不相容。

我該如何解決這個問題?

PS

我無法使用Scala的版本2.11.7因爲我有依賴

"org.sorm-framework" % "sorm" % "0.3.18" 

,由於其依賴關係將產生這樣的問題:

[error] org.scala-lang.modules:scala-xml _2.11, _2.12.0-M3 
[error] org.scala-lang.modules:scala-parser-combinators _2.11, _2.12.0-M3 

回答

4

它似乎SORMS作者is defining Scala library dependencies wrongly。因此,對於諸如[2.10,2.12)之類的版本,您有可怕的傳遞Scala依賴關係,因此它會選擇最新的Scala版本發佈,包括2.12.0-M3顯然。

POM of 0.3.18POM of 0.3.19,似乎後面的版本使用(仍然錯!!)[2.10,2.11.999)

所以我認爲你可以使用這些設置,幫助您解決問題:

scalaVersion := "2.11.7" 
libraryDependencies += "org.sorm-framework" % "sorm" % "0.3.19" 

如果沒有,你將不得不從exclude the problematic transitive dependencies SORM。


更新: bug報告也暗示,你需要排除的依賴實際上是擁抱。例如,使用sbt-dependency-graph插件,運行sbt dependency-dot和檢查結果,我發現:

"com.github.nikita-volkov:embrace:0.1.4" -> "org.scala-lang:scala-compiler:2.12.0-M3" 

這似乎是罪惡的根源。

而不是排除,我現在強迫版本斯卡拉:

scalaVersion := "2.11.7" 

libraryDependencies ++= Seq(
    "org.sorm-framework" % "sorm" % "0.3.19", 
    "org.scala-lang" % "scala-compiler" % scalaVersion.value force() // !! 
) 

這爲我工作。

+0

我改變了版本,如你所說。此外,我使用'exclude'就像這樣:''org.sorm-framework「%」sorm「%」0.3.19「exclude(」org.scala-lang「,」scala-xml「)''。但是,「scala-xml」的問題仍然存在。我試圖按照您使用'exclude'鏈接的指導原則。我的代碼不正確? – octavian

+0

我也試過''org.sorm-framework「%」sorm「%」0.3.19「exclude(」org.scala-lang.modules「,」scala-xml「)' – octavian

+0

請參閱我的編輯。你應該強制使用scala編譯器版本。 –

相關問題