Shorn
Shorn

Reputation: 21436

Caching the Gradle wrapper in AWS CodeBuild

This is what my current buildspec looks like:

phases:
  build:
    commands:
      - ./gradlew soakTest -s

cache:
  paths:
    - '/root/.gradle/caches/**/*'
    - '.gradle/**/*'

But when this buildspec runs in CodeBuild, it prints messages that it is downloading gradle 4.7. It appears that other things are being cached correctly - I don't see log messages about downloading jar dependencies, for example.

What should the buildspec cache specifications look like, in order to make sure the Gradle version that the Gradle wrapper downloads gets cached?

Upvotes: 5

Views: 3234

Answers (2)

Ariel
Ariel

Reputation: 26753

The cache format is just a directory, no wildcards.

Just do:

cache:
  paths:
    - /root/.gradle

Upvotes: 0

Shorn
Shorn

Reputation: 21436

Add the wrapper directory to the cache paths:

- '/root/.gradle/wrapper/**/*'

Upvotes: 5

Related Questions