因springboot默认的打包方式为jar,需要通过java -jar test.jar来完成部署,而一般服务器是要采用tomcat或者weblogic等web容器进行部署的,需要将jar改成打war包
其实改成war包只需要更改几个地方的配置就行了,也比较简单。
一般多模块开发的话,就web下面的pom.xml
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
原文:https://www.cnblogs.com/ruanjianlaowang/p/11182700.html