scf37 / sbt-overwatch

Configurable version of sbt watch feature

Version Matrix

sbt-overwatch plugin

Build status

This plugin is smarter replacement for sbt watch feature (~ command).

Features:

  • ability to watch over multiple directories
  • ability to execute different tasks for different directories

Usage

Add this to project/plugins.sbt:

addSbtPlugin("me.scf37.overwatch" % "sbt-overwatch" % "1.0.11")

Configure plugin and type overwatch:

> overwatch
[info] Waiting for changes on /home/scf37/dev/sbt-overwatch/test includes: **/*.js
[info] Waiting for changes on /home/scf37/dev/sbt-overwatch/test/src/main/resources includes: **/*.css
[info] Waiting for changes on /home/scf37/dev/sbt-overwatch/test includes: **/*.scala
[info] Waiting for changes... (press enter to interrupt)

Plugin configuration constists of fileset -> sbt task pairs. overwatchFilter supports jdk globs or simple Path => Boolean closures.

overwatchConfiguration in Global := Map(
  overwatchFilter(baseDirectory.value, "**/*.js") -> (task1 in overwatchTest),
  overwatchFilter(baseDirectory.value / "src/main/resources", "**/*.css") -> (task2 in overwatchTest),
  overwatchFilter(baseDirectory.value , "**/*.scala") -> (task3 in overwatchTest)
)

See test/build.sbt for complete example including sbt-revolver integration.