Broken image?

Im trying to build a project using Gitlab’s CI and Maven.
Here is valid CI:
image: maven:3-jdk-8

stages:

  • build

build:
stage: build
script:

  • mvn clean compile install -B
    artifacts:
    paths:
  • bootstrap/target/Waterfall.jar
    expire_in: 1 week

after_script:

  • echo “End CI”

After running:
“Error: Could not find or load main class org.apache.maven.surefire.booter.ForkedBooter”

“Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project waterfall-chat: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?”

Same configuration works on another project without any errors.
Thanks.

It seems to be an issue in the upstream Maven image, see https://gitlab.com/gitlab-org/gitlab-ce/issues/53734#note_119420698.

While executing, when JVM does not find a .class file with the specified name then a run time error occurs saying “Could not found or load main class”. The reason why this happens is mostly due to:

  • Wrong Class Name
  • Invalid Classpath

Main class could not be found when there is typo or wrong syntax in the fully qualified java class name or it does not exist in the provided classpath. You must ensure that you add the location of your .class file to your classpath. So, if its in the current folder, add . to your classpath. Note that the Windows classpath separator is a semi-colon( :wink: . If you want to execute the main() method in MainClass, you must use the full class name, including package name, in the java command.