Maven项目打包时候跳过测试的几个方法这里备注下。
方法一
在 pom 中添加插件的形式
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
方法二
通过idea 工具实现,点击右上角 有点像闪电样子的图标,看到 test 被划掉了。然后点击maven 打包的功能就可以跳过测试了。
image.png
方法三
spring-boot-maven-plugin插件已经集成了maven-surefire-plugin插件
只需要在pom.xml里增加
<skipTests>true</skipTests>
即可。
<properties>
<skipTests>true</skipTests>
</properties>