bsky
bsky

Reputation: 20222

Can not resolve dependencies after upgrading to version 2.12

Because I had some dependency issues, I decided to upgrade the Scala installation on my computer to version 2.12.0-M3. I also ran sbt -v, after which many packages were downloaded.

However, when I try to refresh the following build.sbt file

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"

I get the following errors:

    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

Version 2-12.0-M3 appeared in October 2015. It seems doubtful that all these packages are still incompatible.

How can I solve this issue?

PS

I was unable to use scala version 2.11.7 because I have the dependency

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

Which, because of its dependencies, produces this issues:

[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

Upvotes: 1

Views: 1172

Answers (1)

0__
0__

Reputation: 67280

It seems the SORMS author is defining Scala library dependencies wrongly. As a result you have horrible transitive Scala dependencies for versions like [2.10,2.12), so it will pick whatever latest Scala version was published, including in your case 2.12.0-M3 apparently.

Looking at the POM of 0.3.18 and the POM of 0.3.19, it seems that the later version uses (still wrong!!) [2.10,2.11.999).

So I think you can solve your issue using these settings:

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

If not, you will have to exclude the problematic transitive dependencies from SORM.


Update: The bug report also hints that the dependency you need to exclude is actually embrace. For example, using the sbt-dependency-graph plugin, running sbt dependency-dot and inspecting the result I find:

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

which seems to be the origin of the evil.

Instead of excluding, I am now forcing a version of Scala:

scalaVersion := "2.11.7"

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

This worked for me.

Upvotes: 4

Related Questions