Configuration - pford68/gradle-examples GitHub Wiki

Configuring the build environment via gradle.properties

The behavior of Gradle can be configured with Gradle properties, set either from the command line (for a single run) or in a gradle.properties file located in $GRADLE_USER_HOME or in the project.

Best Practice

You want to give the entire team a consistent build environment. So these properties, which configure Gradle, should be set in a way to do that. And they should be looked at as a way to do that.1

Gradle Properties Files Locations

The configuration is applied in following order (if an option is configured in multiple locations the last one wins):

  • from gradle.properties in project build dir.
  • from gradle.properties in gradle user home.
  • from system properties, e.g. when -Dsome.property is set on the command line.

Native Gradle Properties

I won't list all of them here. See the complete list here .

org.gradle.debug

When set to true, Gradle will run the build with remote debugging enabled, listening on port 5005. Note that this is the equivalent of adding -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 to the JVM command line and will suspend the virtual machine until a debugger is attached.

References

Notes

  1. https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties

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 gradle.properties file.