Zil*_*nas 167
有关详细信息,请参阅surefire:test,但最有用的属性是:
-Dmaven.test.failure.ignore = true(或-DtestFailureIgnore = true) - 将忽略测试执行期间发生的任何故障
-Dmaven.test.error.ignore = true(不建议使用) - 将忽略测试执行期间发生的任何错误
-DskipTests - 将编译测试类,但完全跳过测试执行
-Dmaven.test.skip = true - 甚至不编译测试
我相信在你想要编译测试类的情况下,但由于任何测试错误而导致构建失败,并且仍然会创建jar.
您应该使用第一个选项来忽略在构建完成后仍可以查看的任何测试失败.
fas*_*seg 41
mvn -Dmaven.test.skip=true package 跳过surefire测试mojo.
要忽略测试失败并让maven停止,你可以将它添加到pom.xml的部分:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
Sea*_*oyd 25
解决方案是:
mvn -fn clean install
Run Code Online (Sandbox Code Playgroud)
执行mvn --help高级选项
这是-fn的摘录
-fn,--fail-never NEVER fail the build, regardless
of project result
Run Code Online (Sandbox Code Playgroud)
I82*_*uch 18
<properties>
<maven.test.skip>true</maven.test.skip>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
</properties>
Run Code Online (Sandbox Code Playgroud)
http://jira.codehaus.org/browse/SUREFIRE-319
或者从命令行
http://maven.apache.org/maven-1.x/plugins/test/properties.html
maven.test.error.ignore是将此设置为true以忽略测试期间的错误.它的使用不推荐,但偶尔也很方便
使用-DskipTests=true而不是-Dmaven.test.skip=true为了跳过测试但编译它们。
使用-Dmaven.test.failure.ignore=true也可以,但不是很好。
| 归档时间: |
|
| 查看次数: |
79891 次 |
| 最近记录: |