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 dc80b7e
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 package and dump to file
command: dpkg -S $(readlink -f /usr/bin/java) | cut -f1 -d':' > << parameters.filename >>

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

# Download and cache dependencies
- restore_cache:
keys:
- -v5-dependencies-{{ checksum "pom.xml" }}-{{ arch }}
- -v6-dependencies-{{ checksum "pom.xml" }}-{{ checksum "java-package-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-package-lock.txt" }}-{{ arch }}
- run: |
mvn clean install -Dgpg.skip $MVN_EXTRA_OPTS
Expand Down

0 comments on commit dc80b7e

Please sign in to comment.