Maven跳过单元测试配置

介绍二种跳过单元测试的配置方式

使用maven-surefire-plugin,修改pom文件

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-surefire-plugin</artifactId>
	<version>2.20.1</version>
	<configuration>
		<skipTests>${skipTests}</skipTests>
		<encoding>UTF-8</encoding>
	</configuration>
</plugin>

执行以下命令即为跳过测试,如不想跳过测试将执行命令skipTests赋值为false或者不带skipTests命令参数即可

mvn -DskipTests=true install 

使用profile中的配置,修改pom文件

<profiles>
	<profile>
		<id>ignoreTest</id>
		<properties>
			<maven.test.skip>true</maven.test.skip>
		</properties>
	</profile>
</profiles>

  执行下列命令即可跳过测试

mvn -PignoreTest install

猜你喜欢

转载自blog.csdn.net/ifucking/article/details/57915564
今日推荐