gradle maven 打包
gradle 打war bootJar package com.jekjk.replenishment; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; public class MyServletInitializer extends SpringBootServletInitializer { //打包程序使用 @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(ShopReplenishmentApplication.class);//这里的这个类就是启动spring boot的那个运行类 } } plugins { id 'java' id 'java-library' id 'war' id 'org.springframework.boot' version '2.2.2.RELEASE' } apply plugin: 'io.spring