文章目录
- 源码下载
- 搭建
- 项目构建
- 学习博客
源码下载
需要环境 :
- JDK 1.8+
- Maven 3.5+
- Spring Boot 1.x.x: Gradle 版本建议为2.9或更高版本。
- Spring Boot 2.x.x: Gradle 版本建议为4.x.x或更高版本。
GitHub
从v2.3.x开始,SpringBoot开始强制用Gradle构建项目,如需使用maven搭建,可下载v2.2.13.RELEASE版本
这里下载并搭建windows版本
搭建
下载完成后解压,在解压目录下执行Maven项目构建命令:
mvn clean install -DskipTests -Pfast
会下载相关依赖的下载,稍等一会儿。
如果发生错误 :
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:41 min
[INFO] Finished at: 2023-12-11T15:04:42+08:00
[INFO] ------------------------------------------------------------------------
[INFO] 245 goals, 215 executed, 30 from cache, saving at least 2m:37s
[INFO]
[INFO] A build scan was not published as you have not authenticated with server 'ge.spring.io'.
[ERROR] Failed to execute goal com.googlecode.maven-download-plugin:download-maven-plugin:1.4.2:wget (unpack-doc-resources) on project spring-boot-gradle-plugin: IO Error: Error while expanding D:\StudyData\Spring\SpringBoot\SourceCode\spring-boot-2.2.13.RELEASE\spring-boot-project\spring-boot-tools\spring-boot-gradle-plugin\target\refdocs\asciidoc\spring-doc-resources-0.1.3.RELEASE.zip: archive is not a ZIP archive -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :spring-boot-gradle-plugin
则执行 :
mvn clean -rf :spring-boot-gradle-plugin
构建成功 :
项目构建
在源码项目下搭建一个测试模块 :
spring-boot-tests
学习博客
SpringBoot自动装配原理
配置类的加载及FilteringSpringBootCondition执行逻辑及@EnableAutoConfiguration