GitLab CI is failing due to maven-surefire-plugin with VM crash

The issues are related to the latest maven docker images.

There is an open github issue where people reported the same problem: https://github.com/carlossg/docker-maven/issues/90

After an investigation I could sort out the problem using alpine version that saved me of adding the maven-surefire-plugin workaround. It's important to mention that using the surefire workaround brings another problem such as plugins like jacoco don't run since they need the VM fork.

So, these images work seamlessly (no surefire workaround was needed):

  • maven:3.3.9-jdk-8
  • maven:3.5.3-jdk-8
  • maven:3.5.4-jdk-8-alpine
  • maven:3.6.0-jdk-8-alpine

However if we use the non alpine version the issue persists.


I had the same issue

You can find here the issue I created on gitlab for this, with detailed explanations : https://gitlab.com/gitlab-org/gitlab-ce/issues/53734

Also, I found a "workaround". maven:3.5.3-jdk-8 as the docker image on which the build is executing. Or, the forkCount=0 property on maven-surefire-plugin.

But this is disturbing. How, out of a sudden, builds start to fail? Don't know, and I don't think I have the experience necessary to solve this.

Till then, maybe this helps you


Try adding <useSystemClassLoader>false</useSystemClassLoader> to your maven-surefire-plugin configuration.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <useSystemClassLoader>false</useSystemClassLoader>
    </configuration>
</plugin>