将 gradle.properties 文件放在哪里 [英] Where to put the gradle.properties file

查看:306
本文介绍了将 gradle.properties 文件放在哪里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注 Artifactory 1 分钟设置.我在本地主机上启动并运行了 Artifactory,现在我正在尝试将它与 Intellij/Gradle 集成.

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.

artifactory webapp 提供了一个 gradle.propertiesbuild.gradle 文件,所以我试图开始将这些添加到我的 IntelliJ 项目中.但是,我不知道将 gradle.properties 文件放在哪里.

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.

我尝试将gradle.properties 内容(键=值对)复制到gradle/wrapper/gradle-wrapper.properties,不幸的是,这样做并不能生成密钥在 build.gradle 文件中访问.有什么想法吗?

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 在以下位置查找 gradle.properties 文件:

Gradle looks for gradle.properties files in these places:

  • 在项目构建目录中(即您的构建脚本所在的位置)
  • 在子项目目录中
  • 在 gradle 用户主页中(由 GRADLE_USER_HOME 环境变量定义,如果未设置,则默认为 USER_HOME/.gradle)
  • 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 to USER_HOME/.gradle)

一个文件中的属性会覆盖之前的属性(因此 gradle 用户 home 中的文件优先于其他文件,子项目中的文件优先于项目根中的文件).

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).

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

这篇关于将 gradle.properties 文件放在哪里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆