maven打包打jar包、war包打jar包
1、引⼊maven插件
<build>
<finalName>mybatis</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
2、在idea中Maven插件点package
打war包
1、修改l
<!-- 打包⽅式(默认为jar) -->
<packaging>war</packaging>
<build>
<finalName>mybatis</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
2、排除springboot⾃带的tomcat
<!--
配置tomcat启动器,就会排除spring-boot-starter-web中依赖过来的tomcat启动器
指定scope为provided: 代表打war包时,不需要它的依赖jar包(我们有⾃⼰的tomcat)
-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
3、main⽅法继承SpringBootServletInitializer,重写configure⽅法
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@SpringBootApplication
public class DemoApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class,args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
figure(builder);
}springframework jar包导入
}
4、在idea中Maven插件点package
dev打包命令
mvn clean package -st.skip=true -P dev
mvn clean package
分析jar包命令
mvn dependency:analyze
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论