Gradle.properties

From NovaOrdis Knowledge Base
Revision as of 05:43, 5 October 2020 by Ovidiu (talk | contribs) (→‎Overview)
Jump to navigation Jump to search

Internal

Overview

'gradle.properties' files are used to define configuration properties. gradle.properties files can be present in two layers: the user home directory .gradle directory and the project root.

Hierarchy

Gradle User Home gradle.properties

This file is stored in Gradle user home directory ~/.gradle/gradle.properties, conventionally referred to as GRADLE_USER_HOME. Any property declared in this file will be available to all user's Gradle projects.

Project Root gradle.properties

Conventionally, this is where the version of the project is stored:

version=1.0-SNAPSHOT

This file is important because it can be stored in source control, so the entire team working on the project can share the same configuration.

Precedence Rules

Projection

The properties configured in gradle.properties files are flattened according the precedence rules described above and projected into the Project instance where they can be accessed as project properties, similarly to extra properties. For more details see:

Gradle Project Coordinates, State and Configured Properties