How to build a jar using maven, ignoring test results? [duplicate]

Please refer to surefire:test for details, but the most useful properties are:

-Dmaven.test.failure.ignore=true (or -DtestFailureIgnore=true) – will ignore any failures occurred during test execution

-Dmaven.test.error.ignore=true ( deprecated ) – will ignore any errors occurred during test execution

-DskipTests – would compile the test classes but skip test execution entirely

-Dmaven.test.skip=true – would not even compile the tests

I believe that in your case where you want to compile test classes but not fail the build due to any tests errors and still create the jar.

You should use the first option to ignore any test failures which you can still review once the build has finished.

Leave a Comment

tech