①. 坏境搭建说明
①. 注意注意:搭建spring源码环境,IDEA版本要用新版2020系列/2021的IDEA来构建spring源码环境,否则低于2020版本的idea,是不支持gradle 6.8.2以上高版本
②. gradle6.8.2 链接:https://pan.baidu.com/s/1aaOLqaH8Y-Es4lvxxmYnzg 提取码:1234
gradle官网下载地址
JDK15 链接:https://pan.baidu.com/s/1DQyjPmWSn-N8LVJVizamNg 提取码:1234
③. 将下载的gradle解压到磁盘下
④. 配置环境变量
⑤. 配置下载加速
Gradle还是从 maven 仓库下载的。
给gradle安装目录下init.d文件夹,放一个init.gradle文件
allprojects{ repositories { def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/' all { ArtifactRepository repo -> def url = repo.url.toString() if ((repo instanceof MavenArtifactRepository) && (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 } } }
# 下面这个可以不用 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 } } } }
⑥. 配置idea整合
如果你环境变量配置了GRADLE_USER_HOME,idea一般都会自动帮你感应到,如果没有感应到,那你自己指定一下