SpringBoot 打包跳过单元测试的几种方法

时间:2022-02-21 17:49:27

SpringBoot打包时要跳过单元测试有几种方法。

方法一:在properties定义<skipTests>,设置其值为true。

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<skipTests>true</skipTests>
</properties>

方法二:使用maven-surefire-plugin插件

在pom.xml的build里添加插件如下:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.20.1</version>
    <configuration>
        <skipTests>true</skipTests>
    </configuration>
</plugin>