升级到版本2.12

时间:2016-03-01 19:33:36

标签: scala playframework sbt

因为我遇到了一些依赖项问题,所以我决定将计算机上的Scala安装升级到版本2.12.0-M3。我还运行sbt -v,之后下载了许多软件包。

但是,当我尝试刷新以下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

1 个答案:

答案 0 :(得分: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"

如果没有,您将需要来自SORM的exclude the problematic transitive dependencies

更新:错误报告还暗示您需要排除的依赖关系实际上是拥抱。例如,使用sbt-dependency-graph插件,运行sbt dependency-dot并检查结果,我发现:

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

这似乎是邪恶的起源。

而不是排除,我现在强制使用Scala版本:

scalaVersion := "2.11.7"

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

这对我有用。

相关问题