How to define arbitrary tasks in the Play Framework?
I mean tasks run from the command line, something similar to ruby rake.
I\'m aware of the ant tool but l
For Play 2, you can create new tasks using SBT, by following the documentation here:
http://www.scala-sbt.org/release/docs/Detailed-Topics/Tasks
In the context of a Play 2 generated Build.scala, it might look like this:
import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val appName = "foo"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
// Add your project dependencies here,
jdbc,
anorm
)
val hello = TaskKey[Unit]("hello", "Prints 'Hello World'")
val helloTask = hello := {
println("Hello World")
}
lazy val main = play.Project(appName, appVersion, appDependencies).settings(
helloTask
)
}