Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Starting a new Gradle Daemon for this build (subsequent builds will be faster)"... every time

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?

like image 418
Nicolas Raoul Avatar asked May 19 '17 06:05

Nicolas Raoul


People also ask

What is starting a Gradle Daemon?

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.


1 Answers

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.

like image 193
burtsevyg Avatar answered Oct 18 '22 03:10

burtsevyg