Search code examples
scalaplayframeworksbtsorm

scala play sbt configuration for simple tutorial


I'm trying to build my first play app. I'm following the (the video at play tutorial https://www.playframework.com/) but I am having problems with the sbt file.

sorm generates an SBT version conflict.

name := """gig"""

version := "1.0-SNAPSHOT"

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

scalaVersion := "2.11.7"

libraryDependencies ++= Seq(
  jdbc,
  cache,
  ws,
  "org.scalatestplus.play" %% "scalatestplus-play" % "1.5.1" % Test
)

//libraryDependencies += "org.sorm-framework" % "sorm" % "0.3.19"

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

I also get an unresolved repository error if I add: libraryDependencies += "com.h2database" % "h2" % "1.3.148"

How can I solve these 2 problems?

EDIT:

This is the error:

Error:Error while importing SBT project:<br/>...<br/><pre>[info] Resolving com.typesafe.play#play-doc_2.11;1.2.2 ...
[info] Resolving org.pegdown#pegdown;1.4.0 ...
[info] Resolving org.parboiled#parboiled-java;1.1.5 ...
[info] Resolving org.parboiled#parboiled-core;1.1.5 ...
[info] Resolving org.ow2.asm#asm;4.1 ...
[info] Resolving org.ow2.asm#asm-tree;4.1 ...
[info] Resolving org.ow2.asm#asm-analysis;4.1 ...
[info] Resolving org.ow2.asm#asm-util;4.1 ...
[info] Resolving org.scala-lang#scala-compiler;2.11.7 ...
[info] Resolving org.scala-lang.modules#scala-xml_2.11;1.0.4 ...
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[error] Modules were resolved with conflicting cross-version suffixes in {file:/Users/donbeo/Documents/scala_code/gig/}root:
[error]    org.scala-lang.modules:scala-xml _2.11, _2.12.0-M4
[error]    org.scala-lang.modules:scala-parser-combinators _2.11, _2.12.0-M4
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[trace] Stack trace suppressed: run 'last *:ssExtractDependencies' for the full output.
[error] (*:update) Conflicting cross-version suffixes in: org.scala-lang.modules:scala-xml, org.scala-lang.modules:scala-parser-combinators
[error] (*:ssExtractDependencies) Conflicting cross-version suffixes in: org.scala-lang.modules:scala-xml, org.scala-lang.modules:scala-parser-combinators
[error] Total time: 26 s, completed Jun 17, 2016 10:34:45 PM</pre><br/>See complete log in <a href="/Users/donbeo/Library/Logs/IntelliJIdea2016.1/sbt.last.log">/Users/donbeo/Library/Logs/IntelliJIdea2016.1/sbt.last.log</a>

This is the play version addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.4")


Solution

  • It seems like a sorm dependency named embrace is messing up things a little bit.

    Since it was misconfigured, it always asks for the last version of scala, and since scala 2.12 "betas" were released, he is asking for those.

    The same issue is described here:

    Why do I get conflicting cross-version in sbt on one environment but not another?

    To solve your issue you need to force the scala version with:

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

    (You can put it at the end of build.sbt file)

    Then we need to clear the ivy2 cache for sorm:

    rm -r ~/.ivy2/cache/org.sorm-framework/sorm/
    

    Now run

    sbt update
    

    My suggestion would be for you to open an issue about this in sorm or embrace.