Continuous Build allows you to automatically re-execute the requested tasks when file inputs change.
You can execute the build in this mode using the
-t
or
--continuous
command-line option.
For example, you can continuously run the
test
task and all dependent tasks by running:
$ gradle test --continuous
Gradle will behave as if you ran
gradle test
after a change to sources or tests that contribute to the requested tasks.
This means unrelated changes (such as changes to build scripts) will not trigger a rebuild.
To incorporate build logic changes, the continuous build must be restarted manually.
Continuous build uses
file system watching
to detect changes to the inputs.
If file system watching does not work on your system, then continuous build won’t work either.
In particular, continuous build does not work when using
--no-daemon
.
When Gradle detects a change to the inputs, it will not trigger the build immediately.
Instead, it will wait until no additional changes are detected for a certain period of time - the quiet period.
You can configure the quiet period in milliseconds by the Gradle property
org.gradle.continuous.quietperiod
.