5

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).
flurdy
  • 3,782
  • 29
  • 31
schmmd
  • 18,650
  • 16
  • 58
  • 102

3 Answers3

7

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"
    )
}
serg
  • 537
  • 6
  • 14
  • Does this actually work? I am trying right now, but I get `unresolved dependencies play#play_2.9.2;2.0.2: not found` – Andrea Sep 27 '12 at 09:31
  • 1
    No it doesn't. The reason is that there is no scala-2.9.2 build for Play in maven (except for play 2.10 snapshots). Two options: compile play yourself or file a bug report so they provide such a build. – jsalvata Nov 05 '12 at 22:21
  • 1
    I just filed such a bug report -- let's see how it turns out: https://play.lighthouseapp.com/projects/82401-play-20/tickets/837 – jsalvata Nov 05 '12 at 23:14
1

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?

Community
  • 1
  • 1
Yuan Wang
  • 479
  • 2
  • 13
1

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.

Sudheer Aedama
  • 2,116
  • 2
  • 21
  • 39