如何将springboot工程打成jar包

mac2026-08-28  11

如何将springboot工程打成jar包

在启动类中继承SpringBootServletInitializer类重写cofigure方法 @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { return builder.sources(this.getClass()); } 在pom.xml中增加一个build配置 <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>io.renren.RenrenApplication</mainClass> </configuration> </plugin> </plugins> </build> 在工程根目录执行 mvn clean在工程根目录执行 mvn install

原文链接:https://www.jianshu.com/p/c616380095f0

最新回复(0)