SpringBoot打包时跳过单元测试

在打包项目的pom.xml文件中增加配置:

1
2
3
<properties>
<skipTests>true</skipTests>
</properties>

或者是:

1
2
3
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>

变成如下配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<relativePath />
</parent>


<properties>
<skipTests>true</skipTests> <!--等同于命令:mvn package -DskipTests-->
<!--<maven.test.skip>true</maven.test.skip>--> <!--等同于命令:mvn package -Dmaven.test.skip=true-->
</properties>


<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

------ 本文完 ------