jaroop / play-sbt-tasks   2.0.0

GitHub

A very simple SBT plugin for tasks runnable from the Play sbt console

Scala versions: 2.12 2.11 2.10
sbt plugins: 1.0 0.13

Play sbt tasks

A very simple SBT plugin for creating tasks that require a Play application to run one-off tasks within the sbt/activator console.

Installation:

Play SBT tasks is available on maven central. Just add the following to project/plugins.sbt:

addSbtPlugin("com.jaroop" %% "play-sbt-tasks-plugin" % "2.0.0")

and Build.scala, or build.sbt:

libraryDependencies += "com.jaroop" %% "play-sbt-tasks" % "2.0.0"

Usage

To create a new task, extend the abstract class RunnableTask, and implement the execute method:

package com.example

class MyTask(args: String) extends RunnableTask(args) {
	
	def execute: Unit = println("This is my new task.. it doesn't really do anything.")

}

Then register the task in Play's Build.scala:

import com.jaroop.play.sbt.Task

...

  val main = play.Project(appName, appVersion, appDependencies).settings(
      Task.register("myTask", "com.example.MyTask", "Displays a test message.")
  )

Or build.sbt:

import com.jaroop.play.sbt.Task

Task.register("myTask", "com.example.MyTask", "Displays a test message.")