Upgrading a Play Framework application (to 2.2.2)

When you upgrade a Play Framework application from one version to another, such as from 2.1.x to 2.2.x, you have to update a few files. I’m currently upgrading an app from 2.1.x to 2.2.x, and had to change my project/build.properties file to this:

sbt.version=0.13.1

I also had to upgrade my project/plugins.sbt file to this:

// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.2")

The most important line there is the last line.

I did not have to upgrade my project/Build.scala file, but for the record, it looks like this:

import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {

  val appName         = "KBHR"
  val appVersion      = "1.6"

  val appDependencies = Seq(
      "mysql" % "mysql-connector-java" % "5.1.18",
      jdbc,
      anorm,
      "org.mongodb" %% "casbah" % "2.6.2"
    )

  val main = play.Project(appName, appVersion, appDependencies).settings(
    // Add your own project settings here
  )

}

I think Play is moving away from the Build.scala file, because when I look at a new Play 2.2.2 project I see that it’s empty, and I have this build.sbt file in my root directory instead:

name := "Finance"

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
  jdbc,
  anorm,
  cache,
  "mysql" % "mysql-connector-java" % "5.1.18"
)     

play.Project.playScalaSettings

Update

I just found this link on the Play website about how to upgrade to Play 2.2. It has a few other details you might need.