I\'m building android on Gitlab CI and downloading dependencies each time is annoying. I tried caching:
$HOME/.gradle/
$HOME/.gradle/caches/
$GRADLE_HOME/cac
https://stackoverflow.com/a/35478988/2026105
Turns out another post has the answer to this! There is a work around which is to run a before_script that sets the GRADLE_HOME to the directory of your project, which you can then slurp up with the cache directive.
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
cache:
paths:
- .gradle/wrapper
- .gradle/caches
build:
stage: build
script:
- ./gradlew assemble
test:
stage: test
script:
- ./gradlew check