我正在从Play 2.1.3升级到Play 2.5.4。我解决了多个问题,但我现在陷入了最后一步:
我的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
)
}
当我在我的项目上运行激活器时,我收到以下错误:
[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?
有人可以帮忙吗?
答案 0 :(得分:1)
play.Project
被版本2.3的原生sbt项目支持所取代:从此版本migration docs:
如果您之前使用的是play.Project,例如Scala项目:
object ApplicationBuild extends Build { val appName = "myproject" val appVersion = "1.0-SNAPSHOT" val appDependencies = Seq() val main = play.Project(appName, appVersion, appDependencies).settings( ) }
...然后你可以通过本地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 ) }
但是,由于您是从一个非常旧的版本迁移(Play 2.1最后一个版本是在2013年9月),我真的建议您使用build.sbt
而不是project/Build.scala
。迁移将类似于:
name := """dashboard"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
javaJdbc,
cache,
javaWs
)
而且,您需要使用play-ebean,而不是添加javaEbean
。为此,只需将以下行添加到project/plugins.sbt
文件中(这是changed at Play 2.4,您必须将更新后的版本用作documented for Play 2.5):
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "3.0.0")
之后,将您的root
项目定义更改为以下内容:
lazy val myProject = (project in file(".")).enablePlugins(PlayJava, PlayEbean)
这将自动添加Ebean依赖项。最后,我不能建议您阅读2.1和2.5之间版本的所有迁移指南。