Spring源码阅读 (一):源码编译

1. 去github上下载一个springframework的源码包

地址;https://github.com/spring-projects/spring-framework
选择5.0.x分支

2. 下载 gradle

http://downloads.gradle.org/distributions/gradle-4.9-bin.zip
解压,配置 GRADLE_HOME 和 Path选择5.0以下的版本

3. 用Idea打开项目 ,对Idea的gradle进行配置 不然会不兼容。

在这里插入图片描述

4.当项目构建完成之后,便可开始编译。

先
gradlew :spring-oxm:compileTestJava  
然后
gradlew :spring-core:compileTestJava  


导入项目遇见问题:

1.No such property: immutableValues for class: org.gradle.api.internal.tasks.DefaultTaskDependency

修改:spring-beans.gradle

注释掉这两行代码
//def deps = compileGroovy.taskDependencies.immutableValues + compileGroovy.taskDependencies.mutableValues
//compileGroovy.dependsOn = deps - 'compileJava'
2.Could not find method useJUnitPlatform()
注释:spring-test.gradle中这行代码
//  useJUnitPlatform {
//    includeEngines 'junit-jupiter'
//    excludeTags 'failing-test-case'
// }
3.kotlin编译导致的问题
org.gradle.api.CircularReferenceException: Circular dependency between the following tasks:
:spring-beans:compileGroovy
\--- :spring-beans:compileJava
     \--- :spring-beans:compileKotlin
          \--- :spring-beans:compileGroovy (*)

编译github的最新spring源码发现该问题,主要是kotlin版本不一致导致的
在这里插入图片描述
在这里插入图片描述

重点: 将问题1的注释去掉

4.Aspects模块代码编译出错

https://jira.spring.io/browse/SPR-12103
https://youtrack.jetbrains.com/issue/IDEA-64446

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值