项目打包方式
- 构建JAR包
- 构建WAR包
一、构建JAR包
1.在对象的pom.xml文件下面,添加mainclass配置
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.imooc.firstappdemo.FirstAppDemoApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
2.切换到项目所在的目录下,执行跳过单元测试的打包命令
mvn -Dmaven.test.skip -U clean package
3.查看日志,看是否打包成功(在项目的target目录下,会有一个jar文件)
二、构建War包
1.首先修改项目的pom.xml文件
packaging的默认值为jar,调整成war
<packaging>war</packaging>
2.在src/main下,新建webapp/WEB—INF/web.xml文件
3.执行 mvn -Dmaven.test.skip -U clean pacakge命令,在对象的target目录下,会生成一个war包文件