- 由jar变成war
<packaging>war</packaging>
web依赖去除tomcat
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
新增SpringBootStartApplication
- 其中Demo1Application.class为原@SpringBootApplication启动类
package com.trs.stratup; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.support.SpringBootServletInitializer; public class SpringBootStartApplication extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { // TODO Auto-generated method stub return builder.sources(Demo1Application.class); } }
- 其中Demo1Application.class为原@SpringBootApplication启动类
因为有本地依赖的文件所以将依赖路径加入pom.xml
- lib在pom同级路径下
<plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.7</source> <target>1.7</target> <encoding>UTF-8</encoding> <compilerArguments> <extdirs>lib</extdirs> </compilerArguments> </configuration> </plugin>
- lib在pom同级路径下
- 使用mvn clean package打包
springboot war包导出
最新推荐文章于 2024-05-13 18:47:51 发布