4

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?

Shorn
  • 19,077
  • 15
  • 90
  • 168

2 Answers2

4

Add the wrapper directory to the cache paths:

- '/root/.gradle/wrapper/**/*'
Shorn
  • 19,077
  • 15
  • 90
  • 168
  • Just run into the same problem...at least for me it is not working. Problem is it seems CodeBuild with local cache will not cache recursively, but only the wrapper folder. Do you see the same? – ben Mar 06 '20 at 19:15
0

The cache format is just a directory, no wildcards.

Just do:

cache:
  paths:
    - /root/.gradle
Ariel
  • 25,995
  • 5
  • 59
  • 69