Dark theme | Light theme

October 2, 2015

Gradle Goodness: Setting Global Properties For All Gradle Builds

To define project properties outside the Gradle build file, we can define them in a file in our project directory. If we want to define property values that are used by all Gradle builds we can create a file in the GRADLE_USER_HOME directory. By default this is in the USER_HOME/.gradle directory.

In the following example file we assign values to some properties that can be used in all Gradle builds we run on our computer. We store the file in USER_HOME/.gradle.

# Bintray username and password.

# Enable Gradle daemon for all builds.

In the following example build file we simply display the values for the bintrayUser and bintrayPoassword global properties:

// File: build.gradle
task showBintrayProps {
    doLast {
        println "Bintray user/password: ${bintrayUser}/${bintrayPassword}"

Written with Gradle 2.7.