15

I have local and global gradle.properties, the global one is needed to configure the proxy, but it also contains other parameters, wondering what happens if for the same settings you specify different values, which of the files will be in priority or maybe they are How do they merge?

my global gradle.properties

systemProp.http.proxyHost=hostname
systemProp.http.proxyPort=8080
systemProp.http.proxyPassword=password

org.gradle.parallel=false

my local gradle.properties

android.useDeprecatedNdk=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx4096M

For example, which org.gradle.parallel will be used?

Michal Kordas
  • 10,475
  • 7
  • 58
  • 103
Jack J
  • 157
  • 1
  • 7

1 Answers1

17

According to the Gradle properties, the gradle.properties files are applied in the following order:

  1. gradle.properties in project root directory.
  2. gradle.properties in GRADLE_USER_HOME directory.
  3. system properties, e.g. when -Dgradle.user.home is set on the command line.

Because the properties in GRADLE_USER_HOME are applied after the ones in the project root, they override the ones defined in the project. Assuming that with global you mean the one in the GRADLE_USER_HOME directory and local the one in your project root, your value for org.gradle.parallel will be false.

Manuel Jordan
  • 15,253
  • 21
  • 95
  • 158
Jager567
  • 617
  • 4
  • 10
  • 2
    great explanation. Personally I am not totally in agreement with the order between the local gradle.properties file to a project and the global gradle.properties file. I think it would make more sense for the global parameters oto be verwritten by the local parameters to a project ... – soung Oct 25 '20 at 23:53
  • 3
    Be sure to read the link shared on the Post, the order is different about presentation and has a new item – Manuel Jordan Nov 17 '20 at 18:49