Skip to content

Commit

Permalink
[circleci] tie cache to java version
Browse files Browse the repository at this point in the history
  • Loading branch information
truthbk committed Dec 2, 2020
1 parent 2894c40 commit dcab4c4
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
version: 2.1

commands:
create_custom_cache_lock:
description: "Create custom cache lock for java version."
parameters:
filename:
type: string
steps:
- run:
name: Grab java version and dump to file
command: java --version > << parameters.filename >>

default_steps: &default_steps
steps:
- checkout
- create_custom_cache_lock:
filename: java-version-lock.txt

# Download and cache dependencies
- restore_cache:
keys:
- -v5-dependencies-{{ checksum "pom.xml" }}-{{ arch }}
- -v6-dependencies-{{ checksum "pom.xml" }}-{{ checksum "java-version-lock.txt" }}-{{ arch }}
# fallback to using the latest cache if no exact match is found
- -v5-dependencies-
- -v6-dependencies-

- run: mvn dependency:go-offline

- save_cache:
paths:
- ~/.m2
key: -v5-dependencies-{{ checksum "pom.xml" }}-{{ arch }}
key: -v6-dependencies-{{ checksum "pom.xml" }}-{{ checksum "java-version-lock.txt" }}-{{ arch }}
- run: |
mvn clean install -Dgpg.skip $MVN_EXTRA_OPTS
Expand Down

0 comments on commit dcab4c4

Please sign in to comment.