参考:
https://zhuanlan.zhihu.com/p/385370315
这篇文章中,告诉我们如何下载springboot源码
并且,2.2.9之后不在是maven构建
所以,这里下载2.2.9版本进行构建
下载后,导入IDEA中
并新建自己的modules:spring-boot-mytest
自己新建的modules的pom内容如下:
4.0.0 org.springframework.boot spring-boot-starter-parent 2.2.9.RELEASE com.pzj spring-boot-mytest 0.0.1-SNAPSHOT spring-boot-mytest Demo project for Spring Boot 8 jar org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-maven-plugin
这里的parent是2.2.9.RELEASE。这样就可以直接引用我们本地的springboot代码。
此贴中,在spring-boot-mytest里创建自己的controller进行访问。
但是,失败了。
解决办法:
我们需要先构建项目,才能成功。
构建步骤:
第一步:
配置maven镜像地址:
aliyun Nexus Aliyun http://maven.aliyun.com/nexus/content/groups/public/ central ui Nexus UI central http://uk.maven.org/maven2/ ibiblio Nexus Ibiblio central http://mirrors.ibiblio.org/pub/mirrors/maven2/ jboss-public-repository-group Nexus JBoss central http://repository.jboss.org/nexus/content/groups/public repo2 Nexus Repo2 central http://repo2.maven.org/maven2/
第二步:进入spring-boot-2.2.9.RELEASE中。
下载maven-wrapper
https://github.com/bdemers/maven-wrapper
第三步:命令构建
下载完成后
执行以下命令:
Linux: ./mvnw clean install -DskipTests -Pfast Windows mvnw.cmd clean install -DskipTests -Pfast
出现以上画面,就是构建成功。
于是,我们再回到IDEA中
启动 spring-boot-mytest 模块
访问controller即可正常访问。
这样,springboot源码就是构建成功了。



