Triggered Execution 

You can make a command run when certain files change by prefixing the command with ~. Monitoring is terminated when enter is pressed. This triggered execution is configured by the watch setting, but typically the basic settings watchSources and pollInterval are modified.

Some example usages are described below.


The original use-case was continuous compilation:

> ~ test:compile

> ~ compile


You can use the triggered execution feature to run any command or task. One use is for test driven development, as suggested by Erick on the mailing list.

The following will poll for changes to your source code (main or test) and run testOnly for the specified test.

> ~ testOnly example.TestA

Running Multiple Commands 

Occasionally, you may need to trigger the execution of multiple commands. You can use semicolons to separate the commands to be triggered.

The following will poll for source changes and run clean and test.

> ~ ;clean ;test


sbt Reference Manual
      1. Triggered Execution