Using SORM with Play Framework causes reflection exceptions to be thrown

前端 未结 1 1597
野的像风
野的像风 2021-01-14 06:42

I\'ve been trying to get SORM working with Play Framework 2.2-SNAPSHOT as well as 2.1.1. Currently I\'m trying to run a minimalistic sample application that I created in ord

相关标签:
1条回答
  • 2021-01-14 07:01

    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 !
      )
    
    }
    
    0 讨论(0)
提交回复
热议问题