Skip Build failure in maven if the integration test fails

こ雲淡風輕ζ 提交于 2021-01-28 03:10:08

问题


I want to skip the build failure even if the integration test fails. I am using maven-failsafe for Integration test. I am currently getting the following:

Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.15:verify (default) on project xxxxx: There are test failures.

Question: Can I use the following for Maven Failsafe Plugin? I know it works for the Surefire plugin, but not sure for failsafe.

-Dmaven.test.failure.ignore=true

回答1:


Yes, the same parameter is valid for the maven-failsafe-plugin. From the documentation of the verify goal, you can set the testFailureIgnore to true:

Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.

  • Type: boolean
  • Required: No
  • User Property: maven.test.failure.ignore
  • Default: false

The corresponding user property is maven.test.failure.ignore, which means that setting that property on the command line will ignore tests failure.




回答2:


The Maven Failsafe Plugin documentation for the verify goal also provides this option:

Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.

The configuration entry is testFailureIgnore while the user property is indeed maven.test.failure.ignore.

So, running:

mvn clean install -Dmaven.test.failure.ignore=true

Would indeed ignore test failures as you guessed.



来源:https://stackoverflow.com/questions/35730372/skip-build-failure-in-maven-if-the-integration-test-fails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!