Skip to content

编译sping boot

Posted on:December 16, 2022 at 11:00 PM

背景

编译spring boot

流程

github 主页有写怎么编译

## 下载代码
git clone https://github.com/spring-projects/spring-boot.git
## 切换目录
cd spring-boot
## 编译
./gradlew

如果下载国外的包比较慢,可以添加代理

vim build.gradle

编译好的jar包在哪呢? 在每个子模块的build/libs 里面

$ tree spring-boot-project/spring-boot/build/libs/
spring-boot-project/spring-boot/build/libs/
├── spring-boot-3.0.1-SNAPSHOT.jar
└── spring-boot-3.0.1-SNAPSHOT-sources.jar

spring boot 启动

maven 的启动: spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java

	@Override
	public void execute() throws MojoExecutionException, MojoFailureException {
		if (this.skip) {
			getLog().debug("skipping run as per configuration.");
			return;
		}
		String startClass = (this.mainClass != null) ? this.mainClass
				: SpringBootApplicationClassFinder.findSingleClass(this.classesDirectory);  // 查找main类
		run(startClass);   // 启动
	}

相关阅读