放置gradle.properties文件的位置 [英] Where to put the gradle.properties file
问题描述
我正在关注Artifactory 1分钟安装程序。我在本地主机上启动并运行了Artifactory,现在我正在尝试将它与Intellij / Gradle集成。
artifactory webapp提供了一个 gradle .properties
和 build.gradle
文件,所以我想先将这些添加到我的IntelliJ项目中。但是,我不知道在哪里放置 gradle.properties
文件。
我尝试将 gradle.properties
内容(键值对)复制到 gradle /wrapper/gradle-wrapper.properties
,不幸的是,这样做并不能在 build.gradle
文件中访问这些键。任何想法?
Gradle寻找 gradle.properties
文件就是这些位置:
- 在项目构建目录中(即构建脚本所在的位置)
- in sub在gradle user home(由
GRADLE_USER_HOME
环境变量定义,如果没有设置,默认值为)中的-project dir
> USER_HOME / .gradle )
来自一个文件的属性将覆盖以前的属性gradle user home中的文件优先于其他文件,并且子项目中的文件优先于项目根目录中的文件。)
参考: https://gradle.org/docs/current/userguide/build_environment.html
I am following the Artifactory 1-min Setup. I have Artifactory up and running on my localhost, and now I am trying to integrate it with Intellij/Gradle.
The artifactory webapp gives a gradle.properties
and build.gradle
file, so I'm trying to start with adding these to my IntelliJ project. However, I don't know where to put the gradle.properties
file.
I tried copying thegradle.properties
contents (key=value pairs) to gradle/wrapper/gradle-wrapper.properties
, unfortunately doing that does not make the keys accessible in the build.gradle
file. Any ideas?
Gradle looks for gradle.properties
files is these places:
- in project build dir (that is where your build script is)
- in sub-project dir
- in gradle user home (defined by the
GRADLE_USER_HOME
environment variable, which if not set defaults toUSER_HOME/.gradle
)
Properties from one file will override the properties from the previous ones (so file in gradle user home has precedence over the others, and file in sub-project has precedence over the one in project root).
Reference: https://gradle.org/docs/current/userguide/build_environment.html
这篇关于放置gradle.properties文件的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!