準備
- 裝好git工具
- 裝好gradle工具
- 裝好idea(我這裏是用idea閱讀的源碼)
源碼下載
github地址:https://github.com/spring-projects/spring-framework
-
選擇閱讀的版本(我這裏選的是3.2),複製克隆地址準備下載
-
在本地準備存放源碼的文件夾右鍵–> git bash here 後輸入
git clone -b 3.2.x https://github.com/spring-projects/spring-framework.git
後就自己開始了下載源代碼,如圖:
小技巧:git bash 的複製粘貼的快捷鍵與linux一樣 ctrl+insert 、shift+insert
idea導入項目
根據不同版本,請查看源碼中的import-into-idea.md
文件(改文件是Markdown格式文件,可用 http://markdown.xiaoshujiang.com/ 在線打開查看,idea也行),我這以springframework 3.2.x爲例。
- 源碼所在目錄輸入cmd 打開cmd窗口
- 根據
import-into-idea.md
文件中的提示,輸入命令./gradlew :spring-oxm:compileTestJava cleanIdea idea
,我這邊輸入的是gradlew :spring-oxm:compileTestJava cleanIdea idea
, ./ 報錯,結果如圖:
中間報錯,截圖:
* Where:
Script 'D:\workspace\study\github\source-springframework\spring-oxm\oxm.gradle' line: 123
* What went wrong:
Execution failed for task ':spring-oxm:compileTestJava'.
> JiBXException in JiBX binding compilation
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
解決辦法參考博客:https://blog.csdn.net/zx1323/article/details/79706620
下載完jar包之後,最終編譯成功
- idea正常open打開項目即可
後續更新