schmmd
schmmd

Reputation: 19448

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).

Upvotes: 5

Views: 5856

Answers (3)

Sudheer Aedama
Sudheer Aedama

Reputation: 2144

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.

Upvotes: 1

serg
serg

Reputation: 537

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"
    )
}

Upvotes: 7

Yuan Wang
Yuan Wang

Reputation: 479

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?

Upvotes: 1

Related Questions