backTo: https://blog.csdn.net/qq_17079255/article/details/116043429
idea版本:2019.3.5
spring版本:5.0.2
gradle版本:4.3.1
一、下载Spring源码
链接:https://github.com/spring-projects/spring-framework/tree/5.0.x
(本次Spring源码下载版本为5.0.2,点击此处直接下载)
二、下载gradle
参考
20210423# Gradle的安装与配置 : https://blog.csdn.net/qq_17079255/article/details/116045135
三、编译(可省略)
1、执行编译指令
cmd命令行,切换至spring源码根目录,执行如下命令 gradle.bat
2、编译时错误
(如果成功编译,可跳过)
1)错误一
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project ‘spring’.
-Could not resolve all artifacts for configuration ‘:classpath’.
-Could not find org.jetbrains.dokka:integration:0.9.15.
Searched in the following locations:
https://plugins.gradle.org/m2/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.pom
https://plugins.gradle.org/m2/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.jar
https://repo.spring.io/plugins-release/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.pom
https://repo.spring.io/plugins-release/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.jar
Required by:
project : > org.jetbrains.dokka:org.jetbrains.dokka.gradle.plugin:0.9.15 > org.jetbrains.dokka:dokka-gradle-plugin:0.9.15
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
解决方法:修改 D:\spring-framework-5.0.2.RELEASE\build.gradle 文件
注掉 id “org.jetbrains.dokka” version “0.9.15” 语句
新增 id “org.jetbrains.dokka” version “0.9.17” 语句
2)错误二
What went wrong:
A problem occurred evaluating project ‘:spring-beans’.
No such property: values for class: org.gradle.api.internal.tasks.DefaultTaskDependency
Possible solutions: values
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
解决方法:修改 D:\spring-framework-5.0.2.RELEASE\spring-beans\spring-beans.gradle 文件
注掉 compileGroovy.dependsOn = compileGroovy.taskDependencies.values - ‘compileJava’ 语句
3、编译成功
四、导入idea
直接open项目
修改idea gradle配置
刷新
1 去除spring-aspects module
2 test报错解决
启动test类报错
修改run tests方式
然后运行成功