20210423# Spring5源码导入idea

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方式
在这里插入图片描述
然后运行成功
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值