mac配置spring源碼閱讀環境

背景

開發環境:

  • 操作系統:mac os x
  • IDE:IntelliJ IDEA 2016.3

1.從spring的github頁面下載源碼,可以選擇下載zip包或者:

git clone https://github.com/spring-projects/spring-framework.git

由于我本機嘗試git clone發現速度較慢,選擇了下載zip包

2.解壓縮zip包

3.閱讀目錄下的import-into-idea.md文件:

Steps

Within your locally cloned spring-framework working directory:

  1. Precompile spring-oxm with ./gradlew cleanIdea :spring-oxm:compileTestJava
  2. Import into IntelliJ (File -> New -> Project from Existing Sources -> Navigate to directory -> Select build.gradle)
  3. When prompted exclude the spring-aspects module (or after the import via File-> Project Structure -> Modules)
  4. Code away

4.按照Steps的描述,首先預編譯spring-oxm,進入源碼目錄,下發命令:

./gradlew cleanIdea :spring-oxm:compileTestJava

發現報錯,沒有找到辦法解決(查閱資料,可能是網絡問題)

編譯spring-oxm報錯

換一種思路,直接通過IntelliJ IDEA使用gradle構建項目:
1.IntelliJ IDEA,導入項目:


2.選擇spring源碼目錄


3.選擇使用gradle構建:


4.選擇gradle的目錄,然后點擊Finish:


5.然后開始構建,耗時較長(實際耗時超過1個小時),構建完成后如下:


接下來就可以安心地閱讀源碼了,友情提醒下,可以先把Spring技術內幕這本書快速瀏覽一遍,這樣你讀源碼的時候可以有重點,有選擇的去閱讀

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容