哪个文件gradle.properties具有更高的优先级?

时间:2019-04-16 21:30:19

标签: gradle android-gradle gradle.properties

我有本地和全局gradle.properties,配置代理需要全局的gradle.properties,但是它还包含其他参数,想知道如果为相同的设置指定不同的值会发生什么情况,哪个文件优先也许是它们如何合并?

我的全局gradle.properties

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

org.gradle.parallel=false

我的本​​地gradle.properties

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

例如,将使用哪个org.gradle.parallel

我的经验很小,因此很抱歉如果问题很愚蠢,谢谢您的帮助。

1 个答案:

答案 0 :(得分:1)

According to the gradle documentation, 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.