如何在Scala 2.11.6中使用Sorm, 在编译中我收到以下错误
[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
在我的build.sbt中我正在使用...
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
我正在尝试这个例子:https://www.youtube.com/watch?v=eNCerkVyQdcI,但他从未导入过sorm ......
伙计们,我设法解决了......
要解决不一致问题,您应该清除常春藤缓存:
~/.ivy2/cache
但是,您还想修复scala-compiler使用的版本,并希望它与您配置的scalaVersion匹配:
dependencyOverrides += "org.scala-lang" % "scala-compiler" % scalaVersion.value
现在我的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
答案 0 :(得分:1)
我认为问题就在于行
" org.scala琅" %" scala-library" %" 2.11.6"
删除它,因为scala版本应该在你的sbt中:
name := "your name app"
version := "your version"
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
"org.sorm-framework" % "sorm" % "0.3.18"
)
我创建了一个带有激活器的新播放应用程序,因为它显示了播放框架这是build.sbt添加了sorm的依赖:还请删除里面的文件.ivy / cache也许是某种在线脱机依赖,
我还认为问题出在scala 2.11特有的webjars依赖关系上,我使用java 8进行了这个编译,但是在这种情况下这并不重要,重要的想法是你的依赖项的scala版本试试这个:
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