3

How can I use Sorm in Scala 2.11.6, in compile I am getting the following errors

[error] Modules were resolved with conflicting cross-version suffixes in ...
[error] org.scala-lang.modules:scala-xml _2.11, _2.12.0-M1
[error] org.scala-lang.modules:scala-parser-combinators _2.11, _2.12.0-M1

in my build.sbt I am using...

name := "api-psi"

version := "1.0-SNAPSHOT"

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

scalaVersion := "2.11.6"

libraryDependencies ++= Seq(
  "com.h2database" % "h2" % "1.4.177",
  "org.sorm-framework" % "sorm" % "0.3.18",
  "org.webjars" % "bootstrap" % "3.3.5",
  specs2 % Test
)

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

routesGenerator := InjectedRoutesGenerator

I am trying this example: https://www.youtube.com/watch?v=eNCerkVyQdcI , but at no time he imported sorm...

Folks, I managed to solve...

To fix the inconsistency you should to clear your ivy cache:

 ~/.ivy2/cache

However you also want to fix the version of scala-compiler use, and you want it to match your configured scalaVersion:

dependencyOverrides += "org.scala-lang" % "scala-compiler" % scalaVersion.value

Now on my SBT

name := """api-my-psi"""

version := "1.0-SNAPSHOT"

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

scalaVersion := "2.11.6"

libraryDependencies ++= Seq(
  jdbc,
  cache,
  ws,
  specs2 % Test,
  "org.sorm-framework" % "sorm" % "0.3.18",
  "org.webjars" % "webjars-play_2.11" % "2.4.0-1",
  "org.webjars" % "bootstrap" % "3.3.5"
)

dependencyOverrides += "org.scala-lang" % "scala-compiler" % scalaVersion.value

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

routesGenerator := InjectedRoutesGenerator
4

1 回答 1

1

I think that the problem is the line

"org.scala-lang" % "scala-library" % "2.11.6"

remove it because the scala version shoul be in your sbt like this:

name := "your name app" 

version := "your version"

scalaVersion := "2.11.6" 

libraryDependencies ++= Seq(
  "org.sorm-framework" % "sorm" % "0.3.18"
)

I create a new play app with activator as it shows with play framework this is the build.sbt adding the dependency for sorm: , please also remove the files inside .ivy/cache maybe is somekind of online offline dependency,

I also think that the problem was on the webjars dependency that is specific with scala 2.11, I made this compilation using java 8 but this is not relevant in this case, the important think is the scala version for your dependencies try this:

  name := """TestStackOverflow"""

version := "1.0-SNAPSHOT"

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

scalaVersion := "2.11.6"

libraryDependencies ++= Seq(
  jdbc,
  cache,
  ws,
  specs2 % Test,
  "org.sorm-framework" % "sorm" % "0.3.18",
  "org.webjars" % "webjars-play_2.11" % "2.4.0-1",
  "org.webjars" % "bootstrap" % "3.3.5"
)

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
于 2015-08-03T16:13:27.423 回答