使用maven打包时如何跳过test,有以下几种方式
针对spring项目
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
针对springboot
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
- 1
- 2
- 3
- 4
添加如下信息:
<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>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
方式三(通用)
mvn clean install -DskipTests
方式四(通用)
mvn clean install -Dmaven.test.skip=true