1.打包为Jar
配置操作为clean compile package -Dmaven.test.skip=true
debug 操作 在target目录下
2.打包为war包
2.1 pom修改
- 添加packaging
<groupId>org.example</groupId>
<artifactId>sb1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
- 添加tomcat依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
2.2 修改启动类
@SpringBootApplication
public class App extends SpringBootServletInitializer {
public static void main( String[] args ) {
SpringApplication.run(App.class,args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(App.class);
}
}