Gradle Configuration: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 19: Line 19:
==gradle.properties==
==gradle.properties==


<tt>gradle.properties</tt> files can be placed either in Gradle user home directory or in the project root directory. If both files are present, their content is merged and the configuration that comes from the user home directory takes precedence over the configuration that comes from the project root directory. It makes sense to use the user home directory if the project is checked into a repository and we do not want to maintain sensitive information in that file.
<tt>gradle.properties</tt> files can be placed either in Gradle user home directory or in the project root directory. If both files are present, their content is merged and the configuration that comes from the user home directory takes precedence over the configuration that comes from the project root directory.  
 
Form a security perspective, it makes sense to use the user home directory if the project is checked into a repository and we do not want to maintain sensitive information in that file.


{{Internal|gradle.properties#Overview|gradle.properties}}
{{Internal|gradle.properties#Overview|gradle.properties}}

Revision as of 20:34, 22 May 2018

Internal

Overview

Files and Paths

Gradle Home

If Gradle was installed with Homebrew on Mac, then the Gradle home is

/usr/local/Cellar/gradle/<version>/libexec

Gradle User Home

The Gradle user home is the directory indicated by $GRADLE_USER_HOME or $USER/.gradle if the environment variable is not set.

gradle.properties

gradle.properties files can be placed either in Gradle user home directory or in the project root directory. If both files are present, their content is merged and the configuration that comes from the user home directory takes precedence over the configuration that comes from the project root directory.

Form a security perspective, it makes sense to use the user home directory if the project is checked into a repository and we do not want to maintain sensitive information in that file.

gradle.properties

Gradle Project Files

.
|
|- build.gradle
|- settings.gradle
|- gradle.properties
|- .gradle
|    |
|    +-...
|
|- gradlew
+- gradle
      |
      +-wrapper
           |
           +- ...

Project-Level 'gradle' Directory

It may be created automatically on project initialization with gradle init.

Project-Level '.gradle' Directory

It may be created automatically on project initialization with gradle init.

Build Environment Configuration

https://docs.gradle.org/current/userguide/build_environment.html

Gradle behavior is influenced by configuration provided with one or more of the following configuration mechanisms, listed below in the descending order of their precedence:

Command-Line Flags

Gradle Command-Line Interface

System Properties

System properties are stored in a gradle.properties file.

Gradle Properties

Gradle properties are "org.gradle.*" system properties. They are typically stored in a gradle.properties in the project root directory or in Gradle user home.

Environment Variables

Project Properties

Project properties.