user5250681
user5250681

Reputation:

How to cache Gradle dependencies inside Gitlab CI

I add cache property inside my gitlab-ci.yml file in my Android project.

cache:
  paths:
    - .gradle/wrapper
    - .gradle/caches

But in each pipeline when I run ./gradlew assemble, It downloads all gradle dependencies which cause slow build time.

Upvotes: 18

Views: 11518

Answers (1)

Martin Gerhardy
Martin Gerhardy

Reputation: 1990

I'm doing it like this

before_script:
  - export GRADLE_USER_HOME=`pwd`/.gradle

cache:
  paths:
    - .gradle/wrapper
    - .gradle/caches

Upvotes: 31

Related Questions