Nicolas Raoul
Nicolas Raoul

Reputation: 60213

"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?

Upvotes: 23

Views: 29682

Answers (2)

burtsevyg
burtsevyg

Reputation: 4086

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.

Upvotes: 13

Nicolas Raoul
Nicolas Raoul

Reputation: 60213

Upgrading to Gradle 4.0.1 (and presumably later versions) solves the problem.

You can upgrade Gradle by using your packaging system or downloading binaries at https://gradle.org/install/

Upvotes: -1

Related Questions