1、修改pom文件,加入打包插件
<properties>
<packaging>jar</packaging><!--原本是pom改为jar-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
</properties>
2.在Terminal,输入mvn package 或者 mvn clean package(我测试的这个)
想排除测试代码就输出mvn clean package -Dmaven.test.skip=true
最后看见这个就算成功了