Watch Mode Continuous Build

Watch Mode, also known as Continuous Build, is a feature in Gradle that allows you to automatically re-execute tasks when the underlying source files are changed. This is particularly useful for improving development productivity by providing immediate feedback after code changes without needing to manually rerun Gradle tasks every time.

How

./gradlew -t <task-name-to-watch>
Glass thought Sandbox Snapshot

Command to reproduce:

gt.sandbox.checkout.commit 47df08c \
&& cd "${GT_SANDBOX_REPO}" \
&& echo.green "Edit some files in ${GT_SANDBOX_REPO:?}/lib/src/inputs and see how watch reruns gradle task just for those files." \
&& ./gradlew -t incrementalReverse

Recorded output of command:

> Task :lib:incrementalReverse
Executing incrementally
MODIFIED: hi2

BUILD SUCCESSFUL in 44ms
1 actionable task: 1 executed

Waiting for changes to input files... (ctrl-d to exit)
<=============> 100% EXECUTING [1m 2s]

Backlinks