Set no daemon command line option

(Chris L) #1

Is this a simple documentation bug? in:

Via environment variables: add the flag -Dorg.gradle.daemon=false to the GRADLE_OPTS environment variable

Should it be -Porg.gradle.daemon=false instead?

BTW, if I use command line --no-daemon then‘org.gradle.daemon’) will be undefined.


(James Justinic) #2

No, -Dorg.gradle.daemon=false is the correct property to control the build environment configuration. The build environment can be configured with, system properties (-D), or --daemon / --no-daemon options.

It is the case that build environment properties specified in will also show up as project properties, but just specifying a project property with -P will not configure the build environment.

The --daemon / --no-daemon options are the highest precedence way of configuring the build environment. They are not an alternate way to set the build environment property, so you wouldn’t see the equivalent build environment property exposed as a project property.

(Chris L) #3

Thanks for the reply. It make sense for all, except the ‘-P’ vs ‘-D’:

My understanding is:
in gradle.profile key=value can be override with -Pkey=value not -Dkey=value.

Here are there outputs for

logger.quiet "['org.gradle.daemon'] is: ${['org.gradle.daemon']}"
logger.quiet "['org.gradle.daemon'] is : ${['org.gradle.daemon']}"
  1. inside, set org.gradle.daemon=false
  2. command line -Porg.gradle.daemon=false
  3. command line -Dorg.gradle.daemon=false

outputs for case 1 and 2 are the same:['org.gradle.daemon'] is: null['org.gradle.daemon'] is : false

output for case 3 is different as expected:[‘org.gradle.daemon’] is: false[‘org.gradle.daemon’] is : null

So, why -D is correct not -P to match setting value inside gradle.properteis. Maybe org.gradle.daemon is just a special case?

Moreover, Is there someway to verify if the daemon is on or off?

BTW, the doc on

the example was wrong for


it never got overriden


(James Justinic) #4

Consider that there are two different things here: build environment configuration and properties available in the build. The build environment configuration is configured as listed in Build Environment Configuration Properties (project, user, system properties). This has to happen very early to setup the environment which later build setup occurs in and it simply doesn’t look at project properties (but considers as generic potential build environment properties). Yes, the build environment configuration properties set in show up as project properties too, but consider this just a side effect. It’s not what is controlling whether the daemon is really enabled.

A build scan or correlating gradle --status output are your easiest options. A stack trace is also doable, but more difficult in that you need to understand the internals.

This works if the environment variable is correctly set. It won’t be overwritten if you have only copied the and build.gradle contents to your project and run the command provided. You must do the equivalent for your OS to set the appropriate environment variable:

export ORG_GRADLE_PROJECT_envProjectProp=envProjectProp