编译spring源码

spring源码编译流程:

Spring5 源码下载

第 一 步 :
https://github.com/spring-projects/spring-framework/archive/v5.0.2.RELEASE.zip
第二步: 下载 gradle
http://downloads.gradle.org/distributions/gradle-4.1-bin.zip
第三步: 解压,配置 GRADLE_HOME 和 Path
第四步: 验证 gradle -v, 环境变量是否正确
第五步: 点击Sping源码下 gradlew.bat 构建项目

导入项目遇见问题:

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.spring core核心代码报错

这里写图片描述

这里写图片描述
解决方案:
cmd进入该目录
E:>cd xxxspring-frameworkspring-core
执行:
gradle build会生成两个核心jar包

这里写图片描述

4.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版本不一致导致的
这里写图片描述

这里写图片描述
问题二

Error:(434, 19) Kotlin: Calls to static methods in Java interfaces are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'

解决方法
这里写图片描述

5.Aspects模块代码编译出错

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值