Using SORM with Play Framework causes reflection exceptions to be thrown

谁说我不能喝 提交于 2019-12-01 09:07:46

Okay. It's not a bug. SORM 0.3.8 depends on Scala 2.10.1 and Play 2.1.x uses Scala 2.10.0. The exceptions you get are caused by Play mixing artifacts from both Scala versions.

To fix this issue all you need to do is just tell Play to use a proper Scala version by adding scalaVersion := "2.10.1" to project settings in a file project/Build.scala.

The final build script may look like this:

object ApplicationBuild extends Build {

  val appName         = "play-test"
  val appVersion      = "1.0-SNAPSHOT"

  val appDependencies = Seq(
    "org.sorm-framework" % "sorm" % "0.3.8",
    "com.h2database" % "h2" % "1.3.168"
  )

  val main = play.Project(appName, appVersion, appDependencies).settings(
    resolvers += 
      "Local Maven Repository" at 
      "file:///"+Path.userHome.absolutePath+"/.m2/repository",
    scalaVersion := "2.10.1" // <--- ! This is the fix !
  )

}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!