Mave packaged skip the test

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/yhzhaohy/article/details/90484111

Use the command mvn package packaged error.

Here Insert Picture Description
Packaging process, the abnormality test package.
We actually packed when it is no need to test the package, then how in the pack when it skipped Test?

Skip Test, there are two ways:

1)-DskipTests
mvn package -DskipTests

Use packaged in this manner, it does not execute code in the Test package, but will compile it.
Here Insert Picture Description
In addition to controlling the command line, you may be controlled by skipping Test packets POM file.

添加下面插件,打包时跳过Test
<!-- 打包跳过测试-->
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-surefire-plugin</artifactId>
	<configuration>
		<skip>true</skip>
	</configuration>
</plugin>
2)-Dmaven.test.skip=true
mvn package -Dmaven.test.skip=true

Use packaged in this manner, then, under the Test package code, neither the, it can not be complied.
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/yhzhaohy/article/details/90484111