eclipse 如何设置gradle缓存位置?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28838699/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set gradle cache location?
提问by Dims
I see the following info in Eclipse package explorer:
我在 Eclipse 包资源管理器中看到以下信息:
Is it possible to change this location?
这个位置可以改吗?
回答by Andreas Schmid
Globally you can set
您可以全局设置
[...] Gradle user home directory (defined by the “GRADLE_USER_HOME” environment variable, which [...] defaults to USER_HOME/.gradle) [...]
[...] Gradle 用户主目录(由“GRADLE_USER_HOME”环境变量定义,[...] 默认为 USER_HOME/.gradle)[...]
Otherwise for every build manually:
否则对于每个手动构建:
-g, --gradle-user-home Specifies the Gradle user home directory. The default is the .gradle directory in the user's home directory.
-g, --gradle-user-home 指定 Gradle 用户主目录。默认为用户主目录中的 .gradle 目录。
See https://gradle.org/docs/current/userguide/gradle_command_line.html.
请参阅https://gradle.org/docs/current/userguide/gradle_command_line.html。
回答by Alex Cohn
You can change the cache location since gradle 3.5. This is controlled in settings.gradlefile for your project:
从 gradle 3.5 开始,您可以更改缓存位置。这在您的项目的settings.gradle文件中控制:
buildCache {
local {
// Set local build cache directory.
directory = "${settingsDir}/build-cache"
}
}
回答by Hazel
You can change the location of gradle cache location in eclipse by setting the eclipse gradle preference
您可以通过设置 eclipse gradle 首选项来更改 eclipse 中 gradle 缓存位置的位置
In Eclipse open, window-> preferences Search for 'Gradle' set 'Gradle User Home' to your preferred location Click Apply/ok
在 Eclipse 打开,窗口-> 首选项搜索“Gradle”将“Gradle 用户主页”设置为您的首选位置单击应用/确定
Now for the changes to take effect, you might have to do Gradle-> Refresh Gradle Project
现在要使更改生效,您可能必须执行 Gradle-> Refresh Gradle Project
回答by Mark Vieira
You can't change the location of the cache specifically, but you can change the Gradle user home directory (the .gradle directory) which the cache is located in by using the -g
command line argument.
您不能专门更改缓存的位置,但可以使用-g
命令行参数更改缓存所在的 Gradle 用户主目录(.gradle 目录)。