How to fail build in case of a SurefireBooterForkException?

I sometimes have SurefireBooterForkException but the jenkins build is not failed or even test failures are stated (i.e. build is green) and one has to recognize oneself that tests are simply missing in the test result, i.e. there is no information about tests that could not be run.

I found where this is discussed for the configuration parameter -Dmaven.test.failure.ignore, but I don't use this parameter.

Which parameters could also have impact? How could I force a SurefireBooterForkException to verify if that happens reproducible or if other side effects need to be relevant, too?

I don't know if that is important, but I have seen this in integration tests with a fully deployed application, i.e. Selenium tests running in a real scenario (not only Unit tests).

1 answer

  • answered 2018-11-08 08:45 OkieOth

    In my case, the OpenJdk backport to Ubuntu was an issue. I could not predict scenarios in which this bug becomes a problem, but I noticed the bug on every latest Ubuntu-based distributions; older versions were not affected.

    To tackle this, I appended the following POM snippet to the Surefire plugin configurations:


    Next, I configured the JAVA_OPTIONS environment variable for Maven processes:

    NOTE: It is important that the variable is passed to the entire call to Maven and the Surefire plugin.

    # This is a workaround script for a bug in the OpenJDK backport on Ubuntu.
    # Bug causes problems in the Surefire plugin.
    # mvn $@

    In Bamboo, it is sufficient to set the environment variable within a plan's configuration.