2016-03-01 77 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编译器版本。 –

相关问题