Gradle - 使用maven仓库
build.gradle 配置参数:
repositories {
mavenLocal()
mavenCentral()
}
The location for the repository is determined as follows (in order of precedence):
The value of system property 'maven.repo.local' if set;
The value of element <localRepository> of ~/.m2/settings.xml if this file exists and element is set;
The value of element <localRepository> of $M2_HOME/conf/settings.xml (where $M2_HOME is the value of the environment variable with that name) if this file exists and element is set;
The path ~/.m2/repository.
实践:
配置 环境变量:M2_HOME 后,gradle 先从 M2_HOME/conf/settings.xml中的localRepository路径 查找包。如果找到则复用,如果找不到则去mavenCentral下载 并存放于 C:\Users\(用户名)\.gradle\caches\modules-2\files-2.1 下面。
如何修改gradle的缓存目录:

这样配置的话,新的包会存放至 D:\Gradle\gradle-4.6\repository\caches\modules-2\files-2.1下面。
posted on 2018-03-16 11:13 TrustNature 阅读(43) 评论(0) 收藏 举报
浙公网安备 33010602011771号