gradle下载与安装(未更新完毕)
Posted 哇咔咔嗒
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了gradle下载与安装(未更新完毕)相关的知识,希望对你有一定的参考价值。
1、gradle下载地址:https://gradle.org/releases/
2、下载后解压
3、环境变量配置:
GRADLE_HOME:配置你解压gradle的目录,如下图
PATH:配置bin目录,如下图
GRADLE_USER_HOME:类似于maven的本地仓库,下载了所有的jar包,此位置配置gradle的仓库(在解压gradle的路径下新建一个空文件夹gradle)
4、gradle的配置文件(类似于maven的setting文件)
Gradle还是从maven仓库下载
给gradle安装目录下建一个init.d文件夹,放一个init.gradle文件,内容如下:
gradle.projectsLoaded
rootProject.allprojects
buildscript
repositories
def JCENTER_URL = https://maven.aliyun.com/repository/jcenter
def GOOGLE_URL = https://maven.aliyun.com/repository/google
def NEXUS_URL = http://maven.aliyun.com/nexus/content/repositories/jcenter
all ArtifactRepository repo ->
if (repo instanceof MavenArtifactRepository)
def url = repo.url.toString()
if (url.startsWith(https://jcenter.bintray.com/))
project.logger.lifecycle "Repository $repo.url replaced by $JCENTER_URL."
println("buildscript $repo.url replaced by $JCENTER_URL.")
remove repo
else if (url.startsWith(https://dl.google.com/dl/android/maven2/))
project.logger.lifecycle "Repository $repo.url replaced by $GOOGLE_URL."
println("buildscript $repo.url replaced by $GOOGLE_URL.")
remove repo
else if (url.startsWith(https://repo1.maven.org/maven2))
project.logger.lifecycle "Repository $repo.url replaced by $REPOSITORY_URL."
println("buildscript $repo.url replaced by $REPOSITORY_URL.")
remove repo
jcenter
url JCENTER_URL
google
url GOOGLE_URL
maven
url NEXUS_URL
repositories
def JCENTER_URL = https://maven.aliyun.com/repository/jcenter
def GOOGLE_URL = https://maven.aliyun.com/repository/google
def NEXUS_URL = http://maven.aliyun.com/nexus/content/repositories/jcenter
all ArtifactRepository repo ->
if (repo instanceof MavenArtifactRepository)
def url = repo.url.toString()
if (url.startsWith(https://jcenter.bintray.com/))
project.logger.lifecycle "Repository $repo.url replaced by $JCENTER_URL."
println("buildscript $repo.url replaced by $JCENTER_URL.")
remove repo
else if (url.startsWith(https://dl.google.com/dl/android/maven2/))
project.logger.lifecycle "Repository $repo.url replaced by $GOOGLE_URL."
println("buildscript $repo.url replaced by $GOOGLE_URL.")
remove repo
else if (url.startsWith(https://repo1.maven.org/maven2))
project.logger.lifecycle "Repository $repo.url replaced by $REPOSITORY_URL."
println("buildscript $repo.url replaced by $REPOSITORY_URL.")
remove repo
jcenter
url JCENTER_URL
google
url GOOGLE_URL
maven
url NEXUS_URL
5、配置idea整合
6、下载spring源码
Spring在github上的仓库地址是:https://github.com/spring-projects/spring-framework
Spring在码云上的仓库地址是:https://gitee.com/mirrors/Spring-Framework
或者自己同步源码
7、将下载的源码解压以后,导入IDEA,导入步骤如下;
此操作后,等待gradle仓库下载完毕
以上是关于gradle下载与安装(未更新完毕)的主要内容,如果未能解决你的问题,请参考以下文章