我有一个正在运行的多模块Play 2.2应用程序,其组织方式如下...
myApp
+ app
+ conf
+ project
+ build.properties
+ Build.scala
+ plugin.sbt
...其中Build.scala
包含以下语句:
import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val appName = "myApp"
val appVersion = "1.0-SNAPSHOT"
val authDependencies = Seq(
"se.radley" %% "play-plugins-salat" % "1.3.0"
)
val mainDependencies = Seq(
"se.radley" %% "play-plugins-salat" % "1.3.0"
)
lazy val auth = play.Project(
appName + "-auth",
appVersion,
authDependencies,
path = file("modules/auth")).settings(
lessEntryPoints <<= baseDirectory(customLessEntryPoints),
routesImport += "se.radley.plugin.salat.Binders._",
templatesImport += "org.bson.types.ObjectId",
testOptions in Test := Nil,
resolvers ++= Seq(Resolvers.sonatype, Resolvers.scalaSbt)
)
lazy val main = play.Project(
appName,
appVersion,
mainDependencies).settings(
scalacOptions += "-language:reflectiveCalls",
routesImport += "se.radley.plugin.salat.Binders._",
templatesImport += "org.bson.types.ObjectId",
testOptions in Test := Nil,
lessEntryPoints <<= baseDirectory(customLessEntryPoints),
resolvers ++= Seq(Resolvers.sonatype, Resolvers.scalaSbt)
).dependsOn(auth).aggregate(auth)
def customLessEntryPoints(base: File): PathFinder = {
(base / "app" / "assets" / "stylesheets" / "bootstrap" * "bootstrap.less") +++
(base / "app" / "assets" / "stylesheets" * "*.less")
}
}
object Resolvers {
val scalaSbt = Resolver.url("Scala Sbt", url("http://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns)
val sonatype = Resolver.sonatypeRepo("snapshots")
}
现在阅读 Play 2.2 文档,看起来我应该将我的项目转换为 build.sbt:
以下示例使用 build.scala 文件声明 play.Project。此方法是在版本 2.2 之前定义 Play 应用程序的方式。为了支持向后兼容性,保留该方法。我们建议您转换为基于 build.sbt 的方法,或者如果使用 build.scala,则使用 sbt 的 Project 类型和 project 宏。
是否有任何有效的示例,描述如何使用 build.sbt 替换 project/build.scala?我在这里和那里读了一些简短的文章...但是我无法获得一个可用的 Play 项目。