天天看點

spring5.0.x源碼搭建

spring5.0.x源碼搭建

1.下載下傳源碼 https://codeload.github.com/spring-projects/spring-framework/zip/5.0.x

2.下載下傳源碼對應的gradle https://services.gradle.org/distributions/gradle-4.4.1-bin.zip

配置gradle

解壓 gradle-4.4.1-bin.zip

spring5.0.x源碼搭建

配置環境變量

spring5.0.x源碼搭建

配置Path

spring5.0.x源碼搭建

解壓spring源碼到不含中文路徑的目錄

spring5.0.x源碼搭建

配置阿裡雲 下載下傳包位址

spring5.0.x源碼搭建

打開build.gradle 大概在154行添加

spring5.0.x源碼搭建

然後打開gradle目錄進入gradle\wrapper目錄

spring5.0.x源碼搭建

修改gradle-wrapper.properties

spring5.0.x源碼搭建
spring5.0.x源碼搭建

為gradle zip沒解壓目錄

到入項目到idea2020

spring5.0.x源碼搭建
spring5.0.x源碼搭建

然後配置idea gradle

spring5.0.x源碼搭建
spring5.0.x源碼搭建

等待下載下傳包完成然後點選

spring5.0.x源碼搭建

會包一堆錯

切換工作目錄到 spring 源碼工程的根目錄下cmd

執行

spring5.0.x源碼搭建

然後打開idea 點選

spring5.0.x源碼搭建

進入源碼spring-core所在目錄cmd

執行

gradle objenesisRepackJar

gradle cglibRepackJar

保錯

spring5.0.x源碼搭建

下載下傳AspectJ https://ftp.yz.yamagata-u.ac.jp/pub/eclipse//tools/aspectj/aspectj-1.9.0.jar

安裝AspectJ

打開 系統cmd 指令行 切換工作目錄到 下載下傳的AspectJ 所在目錄

執行 java -jar aspectj-1.9.0.jar

spring5.0.x源碼搭建
spring5.0.x源碼搭建
spring5.0.x源碼搭建

為spring-aspect 工程添加Facets屬性

File -> Project Structure -> Facets -> 點選 + 按鈕 -> AspectJ -> 選擇 spring-aop_main -> 點選OK -> 右鍵spring-aop_main的Kotlin 選擇删除

spring5.0.x源碼搭建
spring5.0.x源碼搭建

同上面給spring-aop_main添加Facets屬性一樣 給 spring-aspects_main 也添加Facets屬性

spring5.0.x源碼搭建
spring5.0.x源碼搭建

更改編譯器

spring5.0.x源碼搭建
spring5.0.x源碼搭建

再次編譯 Build -> Build Project

還是在報錯,不過不需要去解決了,因為報錯是 \src\test\ 下面的代碼,不會影響我們看spring源碼,是以不用解決下面問題