赞
踩
要安装Gradle并更改Gradle的镜像源,您可以按照以下步骤进行操作:
GRADLE_HOME
,变量值为Gradle的安装路径,例如:C:\Gradle\gradle-x.x.x(x.x.x代表Gradle的版本号)。Path
的变量,点击“编辑”按钮。;%GRADLE_HOME%\bin
,保留原有的路径不变。gradle -v
命令,如果Gradle成功安装,将显示Gradle的版本信息。init.d
文件夹(如果不存在,请手动创建)。init.d
文件夹中创建一个名为init.gradle
的文件。init.gradle
文件,在其中添加以下内容:allprojects {
repositories {
def REPOSITORY_URL = 'https://your-mirror-url'
all { ArtifactRepository repo ->
if (repo instanceof MavenArtifactRepository) {
def url = repo.url.toString()
if (url.startsWith('https://services.gradle.org') ||
url.startsWith('https://downloads.gradle.org')) {
project.logger.lifecycle "Changing repository URL for ${repo.url} to $REPOSITORY_URL."
repo.url = new URL(REPOSITORY_URL)
}
}
}
}
}
https://your-mirror-url
替换为您想要使用的镜像源的URL。Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。