Hello. I’m trying to make a build & test pipeline for a Gradle project written in Kotlin using Spek Framework, but I get java.lang.NoClassDefFoundError on Spek tests which are based on Kotlin singleton objects (I think this might be the issue). The tests complete on my local machine and in my local Docker environment using both java and gradle images.
My CI script is as follows:
image: gradle:5.6.2
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
build:
stage: build
script: gradle --build-cache assemble
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
test:
stage: test
script: gradle check --info
cache:
key: "$CI_COMMIT_REF_NAME"
policy: push
paths:
- build
- .gradle
artifacts:
reports:
junit: build/test-results/test/TEST-*.xml
And the gradle test task output with --info flag: