Gradle provides several options that make it easy to configure the Java process that will be used to execute your build.
While it's possible to configure these in your local environment via GRADLE_OPTS or JAVA_OPTS,
certain settings like JVM memory settings, Java home, daemon on/off
can be more useful if they can be versioned with the project in your VCS so that
the entire team can work with a consistent environment.
Setting up a consistent environment for your build is as simple as placing these settings into a
The configuration is applied in following order
(if an option is configured in multiple locations the last one wins):
gradle.propertiesin project build dir.
gradle user home.
-Dsome.propertyis set on the command line.
The following properties can be used to configure the Gradle build environment:
When set to
true the Gradle daemon is used to run the build.
For local developer builds this is our favorite property. The developer environment is optimized for speed and feedback
so we nearly always run Gradle jobs with the daemon.
We don't run CI builds with the daemon (i.e. a long running process)
as the CI environment is optimized for consistency and reliability.
Specifies the java home for the Gradle build process.
The value can be set to either a
however, depending on what your build does,
jdk is safer.
A reasonable default is used if the setting is unspecified.
Specifies the jvmargs used for the daemon process. The setting is particularly useful for tweaking memory settings. At the moment the default settings are pretty generous with regards to memory.
Enables new incubating mode that makes Gradle selective when configuring projects. Only relevant projects are configured which results in faster builds for large multi-projects. See Section 18.104.22.168, “Configuration on demand”.
When configured, Gradle will run in incubating parallel mode.
Many settings (like the java version and maximum heap size) can only be specified when launching a new JVM for the build process. This means that Gradle
must launch a separate JVM process to execute the build after parsing the various
When running with the daemon, a JVM with the correct parameters is started once and reused for each daemon build execution.
When Gradle is executed without the daemon, then a new JVM must be launched for every build execution,
unless the JVM launched by the Gradle start script happens to have the same parameters.
This launching of an extra JVM on every build execution is quite expensive, which is why if you are
we highly recommend that you use the Gradle Daemon. See Chapter 19, The Gradle Daemon for more details.
Configuring an HTTP proxy (for downloading dependencies, for example) is done via standard JVM system
properties. These properties can be set directly in the build script; for example, setting the proxy host
would be done with
Alternatively, the properties can be specified in a gradle.properties file, either in the build's root
directory or in the Gradle home directory.
Example 20.1. Configuring an HTTP proxy
systemProp.http.proxyHost=www.somehost.org systemProp.http.proxyPort=8080 systemProp.http.proxyUser=userid systemProp.http.proxyPassword=password systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
There are separate settings for HTTPS.
Example 20.2. Configuring an HTTPS proxy
systemProp.https.proxyHost=www.somehost.org systemProp.https.proxyPort=8080 systemProp.https.proxyUser=userid systemProp.https.proxyPassword=password systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost
We could not find a good overview for all possible proxy settings. One place to look are the constants in a file from the Ant project. Here's a link to the Subversion view. The other is a Networking Properties page from the JDK docs. If anyone knows of a better overview, please let us know via the mailing list.
If your proxy requires NTLM authentication, you may need to provide the authentication domain as well as the username and password. There are 2 ways that you can provide the domain for authenticating to a NTLM proxy:
http.proxyUsersystem property to a value like