You can make a command run when certain files change by prefixing the
~. Monitoring is terminated when
enter is pressed. This
triggered execution is configured by the
watch setting, but typically
the basic settings
pollInterval are modified.
watchSourcesdefines the files for a single project that are monitored for changes. By default, a project watches resources and Scala and Java sources.
watchTransitiveSourcesthen combines the
watchSourcesfor the current project and all execution and classpath dependencies (see .scala build definition for details on interProject dependencies).
pollIntervalselects the interval between polling for changes in milliseconds. The default value is 500 ms.
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)
testOnly for the specified test.
> ~ testOnly example.TestA
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 ;test