Spring boot源碼分析-環境搭建
源碼的下載
-
springboot源碼托管在github spring-boot

-
Fork spring-boot源碼(fork完成以后可以自行修改源碼)

-
克隆代碼到本地倉庫

源碼構建
-
查看源碼地址 找到 Building from Source CONTRIBUTING.adoc
-
看到Working with the code上面關於 Building from source的介紹 大致的意思:
-
建議使用 Spring Tools Suite or Eclipse 來構建代碼 不過個人建議使用idea
-
使用maven 3.2.1或者更高的版本 使用jdk1.8
-
默認的構建方式使用maven命令
$ ./mvnw clean install
提示:可以設置maven的環境 MAVEN_OPTS -Xmx512m- 1
- 2
-
如果你是重新構建的 可以直接使用下列命令跳過檢查
$ ./mvnw clean install -DskipTests -Pfast -
通過兩階段進行全量構建
1)Prepare the build 准備構建 安裝spring-boot-maven-plugin插件
$ ./mvnw -P snapshot,prepare install -DskipTests2) Run the full build 執行構建任務
$ ./mvnw -s ./settings.xml -f spring-boot-full-build -P full clean install
-
-
下面我們看一下全量構建
- 執行 $ ./mvnw -P snapshot,prepare install -DskipTests


- 執行 $ ./mvnw -P snapshot,prepare install -DskipTests
-
執行(執行時間會比較久) $ ./mvnw -s ./settings.xml -f spring-boot-full-build -P full clean install


-
執行成功以后 可以通過idea導入maven工程

選擇通過已經存在的代碼新建
選擇maven工程,然后默認完成余下的向導操作 -
接下來,解決一些maven依賴的問題 就可以進行學習之旅了
. _ _ _
/\ / ‘ _ ()_ _ _ _ \ \ \ \
( ( )___ | ‘_ | ‘| | ‘ \/ _` | \ \ \ \
\/ _)| |)| | | | | || (| | ) ) ) )
’ |_| .|| ||| |_, | / / / /
=========||==============|__/=///_/
:: Spring Boot ::
