Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which file gradle.properties is higher priority?

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?

like image 776
Jack J Avatar asked Apr 16 '19 21:04

Jack J


People also ask

What is Gradle properties file used for?

Gradle project properties provide an easy way to customise builds which may need to run differently in certain situations. In this article you'll learn the most effective ways to use and set properties, along with some common scenarios you might come across in your Gradle project.

How do you define properties in build Gradle?

Defining properties via system properties We use the -D command-line option just like in a normal Java application. The name of the system property must start with org. gradle. project , followed by the name of the property we want to set, and then by the value.


1 Answers

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.

like image 198
Jager567 Avatar answered Oct 22 '22 10:10

Jager567