spring源码编译遇到的问题:
首先github上下载spring太慢,可以使用码云的地址:
https://gitee.com/wangxuwen/spring-framework/tree/v5.2.0.RELEASE/
安装gradle–并配置环境变量
mac版本下:
vi ~/.bash_profile
#GRADLE
GRADLE_HOME=/Users/qinxy/software/gradle-5.6.2
PATH=$PATH:$GRADLE_HOME/bin
export GRADLE_HOME GRADLE_USER_HOME PATH
source ~/.bash_profile
高版本和低版本都会遇到问题,这里建议安装gradle5.x版本的
gradle-5.6.2-bin
#这里不改的话,编译的时候会报错
id "com.gradle.build-scan" version "3.8.1"
打开源码:
在E:\www\Spring-Framewor5.2\gradle\wrapper\gradle-wrapper.properties下
防止它重复下载gradle
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
#distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
distributionUrl=gradle-5.6.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
idea的kotlin插件版本更换为低版本:kotlin-plugin-1.4.0
spring源码里gradle的镜像改为:
buildscript下
repositories {
maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/' }
maven{ url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
configurations.all上面添加
跟
resolutionStrategy {
cacheChangingModulesFor 0, "seconds"
}
同级别
repositories {
maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'}
maven{ url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'}
mavenCentral()
maven { url "https://repo.spring.io/libs-spring-framework-build" }
}
然后加载编译