Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using scala 2.9.2 with Play?

I have a Play project. Unfortunately I am deserializing some case classes that were serialized using scala 2.9.2. Since play uses 2.9.1 there is a InvalidClassException.

Caused by: java.io.InvalidClassException: scala.Option; local class incompatible: stream classdesc serialVersionUID = 2832403187243187948, local class serialVersionUID = 7113474029577970182

Is it possible to force play to use scala 2.9.2? The play project configuration seems to be doing a lot magically. There's not much in projects/Build.scala.

import sbt._
import Keys._
import PlayProject._

object ApplicationBuild extends Build {
    val appName         = "myproj"
    val appVersion      = "1.0-SNAPSHOT"
}

Since 2.9.2 is binary compatible with 2.9.1 I should be able to force it to be used--but I have no idea how to!

Update: adding scala 2.9.2 as a dependency gives me the following error.

[error] {file:/home/schmmd/repo/openie-demo/}openiedemo/*:update: Version specified for dependency org.scala-lang#scala-lang;2.9.2 differs from Scala version in project (2.9.1).
like image 440
schmmd Avatar asked May 09 '12 23:05

schmmd


3 Answers

try to update your Build.scala

object ApplicationBuild extends Build {

    val appDependencies = Seq(
       // Add your project dependencies here,
       "org.scala-lang" % "scala-compiler" % "2.9.2",
      ...
    )

    val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).setting(
      // Add your own project settings here
      scalaVersion := "2.9.2"
    )
}
like image 158
serg Avatar answered Nov 11 '22 15:11

serg


There is no sbt plugin for Play 2.0.4 compatible with Scala 2.9.2 as play 2.0.4 was built on SBT 0.11.x. Play! upgraded to Scala 2.9.2 using SBT 0.12.x and this broke the backward compatibility of Play 2.0.4 to use Scala 2.9.2

However, there is a back-port for Scala 2.9.3. Change your scalaVersion to 2.9.3 in your Build file to use play 2.0.4 SBT plugin.

like image 24
Sudheer Aedama Avatar answered Nov 11 '22 15:11

Sudheer Aedama


you can change the scala version in sbt. Not sure whether there is play sbt plugin for 2.9.2 yet.

How to change Scala version for sbt project?

like image 1
Yuan Wang Avatar answered Nov 11 '22 13:11

Yuan Wang