We are using GitLab Enterprise Edition 13.12.2-ee on a company-provided Dockermachine runner to build Maven-based projects. They set MAVEN_OPTS to contain environment-specific parameters like Proxy settings. For our build, we need to append MAVEN_OPTS, for example to set -Dmaven.repo.local to enable caching of our local Maven repository. I tried several variants for this in our .gitlab-ci.yml:
build:
variables:
MAVEN_OPTS: $MAVEN_OPTS "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
MAVEN_OPTS: "$MAVEN_OPTS -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
MAVEN_OPTS: ${MAVEN_OPTS} "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
MAVEN_OPTS: "${MAVEN_OPTS} -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
MAVEN_OPTS: $$MAVEN_OPTS "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
MAVEN_OPTS: "$$MAVEN_OPTS -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
Of course only one at a time, not all at once. None of them seems to work. Does anyone have a hint, how to accomplish this?