1

Currently our pipeline does and this creates a war file and puts in into the server

mvn clean test package

We are now trying to add surefire reports for those tests, everything works well when all tests pass

mvn clean test site package

But if some test fails then site does not get called and we have no report.

Although I know that site has tests inside as well so we tried but even if there was failing tests the site command did not make it to be failing and build succeeded.

mvn clean site package

What is the best approach to get tests and surefire report.

Mart123
  • 327
  • 2
  • 13

1 Answers1

1

With How to build a jar using maven, ignoring test results?

and https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#testFailureIgnore:

<testFailureIgnore>(element) boolean(type) -((ever) since)

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

Default value is: false.

User property is: maven.test.failure.ignore.

Using:

mvn -Dmaven.test.failure.ignore=true clean package site

Will:

  • clean
  • package (including tests + test results, unless skipped)
  • not fail the build, when tests fail
  • and generate the project report (site)
xerx593
  • 12,237
  • 5
  • 33
  • 64