Reputation: 11
I am upgrading from Play 2.1.3 to Play 2.5.4. I resolved multiple issues but I am now stuck at one last step I guess:
My project/Build.scala
:
import sbt._
import Keys._
import play.sbt._
import Play.autoImport._
import PlayKeys._
object ApplicationBuild extends Build {
val appName = "dashboard"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
// Add your project dependencies here,
javaCore,
javaJdbc,
javaEbean
)
val main = play.Project(appName, appVersion, appDependencies).settings(
// Add your own project settings here
)
}
When I do activator run on my project, I get the following error:
[error] \project\Build.scala:19: object Project is not a member of package play
[error] val main = play.Project(appName, appVersion, apDependencies).settings(
[error] ^
[error] one error found
[debug] Compilation failed (CompilerInterface)
[error] (compile:compileIncremental) Compilation failed
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
Can someone please help?
Upvotes: 1
Views: 337
Reputation: 12202
play.Project
was replaced by native sbt Project support at version 2.3:. From this version migration docs:
If you were previously using play.Project, for example a Scala project:
object ApplicationBuild extends Build { val appName = "myproject" val appVersion = "1.0-SNAPSHOT" val appDependencies = Seq() val main = play.Project(appName, appVersion, appDependencies).settings( ) }
...then you can continue to use a similar approach via native sbt:
object ApplicationBuild extends Build { val appName = "myproject" val appVersion = "1.0-SNAPSHOT" val appDependencies = Seq() val main = Project(appName, file(".")).enablePlugins(play.PlayScala).settings( version := appVersion, libraryDependencies ++= appDependencies ) }
But, since you are migrating from a very old version (Play 2.1 last release was in Sep 2013), I truly recommend you to use build.sbt
instead of project/Build.scala
. The migration would be something like:
name := """dashboard"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
javaJdbc,
cache,
javaWs
)
And, instead of adding javaEbean
, you will need to use play-ebean instead. To do so, just add the following line to your project/plugins.sbt
file (this was changed at Play 2.4 and you have to use the updated version as documented for Play 2.5):
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "3.0.0")
After that, change your root
project definition to something like this:
lazy val myProject = (project in file(".")).enablePlugins(PlayJava, PlayEbean)
This will automatically add Ebean dependencies. Finally, I can't recommend enough that you read all the migration guides for version between 2.1 and 2.5.
Upvotes: 1