You can enable the Gradle Daemon to improve the performance of your builds.
The Gradle Daemon keeps the Gradle Framework initialized and running, and caches project data in memory to improve performance.
For a Single Build
To enable the Daemon for a single build, you can simply pass the --daemon
argument to your gradle
command or Gradle Wrapper script.
gradle --daemon
./gradlew --daemon
For All Builds of a Project
To enable the Daemon for all builds of a project, you can add:
org.gradle.daemon=true
To your project's gradle.properties
file.
For All Builds
To enable the Gradle Daemon by default, for every build made by your user account on your system, edit $GRADLE_USER_HOME/.gradle/gradle.properties
(~/.gradle/gradle.properties
by default) and add this line:
org.gradle.daemon=true
You can also do this in a single command on Mac/Linux/*nix systems:
touch ~/.gradle/gradle.properties && echo "org.gradle.daemon=true" >> ~/.gradle/gradle.properties
Or on Windows:
(if not exist "%USERPROFILE%/.gradle" mkdir "%USERPROFILE%/.gradle") && (echo org.gradle.daemon=true >> "%USERPROFILE%/.gradle/gradle.properties")
Disabling the Daemon
You can disable the Daemon for a specific build using the --no-daemon
argument, or disable it for a specific project by explicitly setting org.gradle.daemon=false
in the project's gradle.properties
file.
Stopping the Daemon
If you wish to stop a Daemon process manually, you can either kill the process via your operating system task manager or run the gradle --stop
command. The --stop
switch causes Gradle to request that all running Daemon processes, of the same Gradle version used to run the command, terminate themselves. Ordinarily, Daemon processes will automatically terminate themselves *after *3 hours of inactivity or less.