安装
- gradle下载
- 解压到D:\gradle-4.3
- 修改windows环境变量
setx "GRADLE_HOME" "D:\gradle-4.3" /m
setx Path "%GRADLE_HOME%\bin;%Path%"
setx GRADLE_USER_HOME "C:\Users\${你的用户名}\.gradle"
- 新建C:\Users${你的用户名}.gradle\init.gradle文件,内容
allprojects{
repositories {
def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/'
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL."
remove repo
}
}
}
maven {
url REPOSITORY_URL
}
}
}