I use Gradle 2.10 on Ubuntu 16.04.1 LTS
I was getting told "This build could be faster, please consider using the Gradle Daemon" so I created a ~/.gradle/gradle.properties
file containing org.gradle.daemon=true
.
Result: Every time I run ./gradlew build
, I am now told:
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
... every single time. And the build does not get faster and faster: it always takes about 10 seconds. If I run the build 3 times in a row, it outputs the message above 3 times, and though I am well below Gradle's 3 hours of inactivity automatic shutdown.
How to fix this and make the daemon survive for a longer time?
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.
In the root of the project create gradle.properties
with
org.gradle.daemon=true
It keeps the instance of gradle up and running in the background even after your build finishes.
It doesn't work for CI environment (travis ci for example) if your environment recreated every build.
Also: Gradle will kill any Daemon that has been idle for 3 hours or more, so you don’t have to worry about cleaning them up manually.
There are no configs in default gradle for increase daemon uptime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With