I have spent an ample lot of time on this, and it doesn't seem to work. Have tried on multiple projects.
We host our gitlab runner ourselves (on our AWS via EKS) managed by Gitlab (SaaS). I want it to cache the maven dependencies.
When I configure it based on the reference example: https://gitlab.com/gitlab-org/gitlab-ci-yml/blob/master/Maven.gitlab-ci.yml , it still downloads all the dependencies every time.
stages:
- test
- pack
image: maven:3.6.1-jdk-8
variables:
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
cache:
paths:
- .m2/repository
stylecheck_and_test:
stage: test
only:
- tags
- schedulers
- web
- triggers
- branches
script:
- mvn $MAVEN_CLI_OPTS install -Dmaven.test.skip=true
- mvn $MAVEN_CLI_OPTS clean test
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…