Each module can have a gradle.properties file. This file defines build properties, for example, dynamoHome, that are used by the build process.

Note that the gradle.properties file cannot use variables in build property values. In other words, the file must use:

dynamoHome=C:/work/ATG/platform/Dynamo/home

Instead of

dynamoHome=${env.dynamoHome}/..

In order to use variables in build property values, the properties must be defined in a build.gradle file instead of the gradle.properties file. This can be either the root build.gradle file, if the properties are used by multiple Gradle projects, or the build.gradle file of the specific project that requires the properties. You define the properties using Gradle’s ExtraPropertiesExtension API, which uses a syntax that looks like this:

project.ext.myProperty = propertyValue1;
project.ext.myOtherProperty = propertyValue2;

Alternatively, you can set multiple properties using a Gradle configuration closure:

project.ext {
       myProperty = "propertyValue1"
       myOtherProperty = "propertyValue2"
    }

The combination of the settings in the gradle.properties file and the project.ext.<property> definitions acts as a key/value map that provides access to the build properties to other build files.

IMPORTANT: The example above sets dynamoHome. Note that, when setting dynamoHome in the gradle.properties file, you must use forward slashes, even if you are on Windows.


Copyright © 1997, 2016 Oracle and/or its affiliates. All rights reserved. Legal Notices