I receive the following error message when trying to make a build with Jenkins Pipeline. It says that it cannot find the report files. But according to my understanding should these report files not be generated while executing the tests? Locally I can run the tests with mvnw clear test and the files are generated in the target folder (Maven Project). As the target folder contains build files, I dont assume that I have to upload these files to the git Repo? For any kind of help, I would be very happy!
Jenking Build Failure:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Error: Invalid or corrupt jarfile /var/lib/jenkins/jobs/tool Job/workspace/target/surefire/surefirebooter1117922841156378420.jar
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.507 s
[INFO] Finished at: 2017-10-07T15:21:53Z
[INFO] Final Memory: 58M/398M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project j-hipster-irp: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd "/var/lib/jenkins/jobs/tool Job/workspace" && /usr/lib/jvm/java-8-openjdk/jre/bin/java '-javaagent:/var/lib/jenkins/.m2/repository/org/jacoco/org.jacoco.agent/0.7.9/org.jacoco.agent-0.7.9-runtime.jar=destfile=/var/lib/jenkins/jobs/tool Job/workspace/target/test-results/coverage/jacoco/jacoco.exec' -Djava.security.egd=file:/dev/./urandom -Xmx256m -jar '/var/lib/jenkins/jobs/tool Job/workspace/target/surefire/surefirebooter1117922841156378420.jar' '/var/lib/jenkins/jobs/tool Job/workspace/target/surefire/surefire1734872125374791310tmp' '/var/lib/jenkins/jobs/tool Job/workspace/target/surefire/surefire_03108578491450238058tmp'
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[Pipeline] junit
Recording test results
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: No test report files were found. Configuration error?
Finished: FAILURE
The Jenkinsfile contains:
#!/usr/bin/env groovy
node {
stage('checkout') {
checkout scm
}
stage('check java') {
sh "java -version"
}
stage('clean') {
sh "chmod +x mvnw"
sh "./mvnw clean"
}
stage('install tools') {
sh "./mvnw com.github.eirslett:frontend-maven-plugin:install-node-and-yarn -DnodeVersion=v6.11.3 -DyarnVersion=v1.1.0"
}
stage('yarn install') {
sh "./mvnw com.github.eirslett:frontend-maven-plugin:yarn"
}
stage('backend tests') {
try {
sh "./mvnw test"
} catch(err) {
throw err
} finally {
junit '**/target/surefire-reports/TEST-*.xml'
}
}
stage('frontend tests') {
try {
sh "./mvnw com.github.eirslett:frontend-maven-plugin:yarn -Dfrontend.yarn.arguments=test"
} catch(err) {
throw err
} finally {
junit '**/target/test-results/karma/TESTS-*.xml'
}
}
stage('packaging') {
sh "./mvnw package -Pprod -DskipTests"
archiveArtifacts artifacts: '**/target/*.war', fingerprint: true
}