Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get maven to run all tests but still fail build on compile error

Suppose I have a multi-module maven project. I want to run it in such a way that:

  • If a test fails, I still want to compile and test the next module. This sounds like a job for --fail-never, but see below.
  • If there are test failures, I don't really care if the build succeeds or fails. Ideally this would be configurable, but whatever.
  • If there are compiler errors, then the build should fail. I think this rules out "fail-never"?
like image 974
Mark VY Avatar asked Oct 15 '25 23:10

Mark VY


1 Answers

You can use surefire parameter: maven.test.failure.ignore

mvn test -Dmaven.test.failure.ignore

With this options failing test will not fail build a module and finally whole build will have success result.

like image 76
Slawomir Jaranowski Avatar answered Oct 18 '25 18:10

Slawomir Jaranowski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!