Reputation: 3319
How do I add a task to a Play (SBT) project that uses a full build configuration, say Build.scala
, so that it is actually visible and can be used?
Apparently what I did is not enough. When I run play tasks
the new task is not listed and I cannot run it.
Build.scala looks as follows:
object ApplicationBuild extends Build {
val hello = TaskKey[Unit]("hello", "Prints 'Hello World'")
val helloTask = hello := {
println("Hello World")
}
val appName = "test"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
jdbc
)
val main = play.Project(appName, appVersion, appDependencies).settings(
resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/"
)
}
Upvotes: 0
Views: 536
Reputation: 74669
Add the helloTask
as a setting within settings
method as follows:
val main = play.Project(appName, appVersion, appDependencies).settings(
resolvers += "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/",
helloTask
)
See Full Configuration Example for SBT 0.12.4 since you use the older approach to define tasks with TaskKey
and the double assign (helloTask = hello :=
). You may find the reference to Scalaz's full build configuration very useful (at the very bottom of the page).
Upvotes: 2