Skip to content

Commit e6e5c28

Browse files
committed
clear m2-cache prior to mill execution
1 parent 161084e commit e6e5c28

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

.github/workflows/mill-plugin-tests.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ jobs:
1919
with:
2020
java-version: 11
2121
distribution: 'temurin'
22-
- name: Cache maven dependencies
23-
uses: actions/cache@v5
24-
env:
25-
cache-name: cache-maven-repository
22+
- name: Restore cache (read-only)
23+
# only use restore keys, no save key because we need to clear the cache before running the examples
24+
uses: actions/cache/restore@v4
2625
with:
2726
path: |
2827
~/.m2/repository
@@ -31,19 +30,24 @@ jobs:
3130
!~/.gradle/caches/*/plugin-resolution/
3231
!~/.m2/repository/org/openapitools/
3332
!~/.cache/coursier/v1/https/repo1.maven.org/maven2/org/openapitools/
34-
!~/.m2/repository/com/fasterxml/
35-
!~/.m2/repository/org/slf4j/
36-
!~/.m2/repository/javax/validation/
3733
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
38-
restore-keys: |
39-
${{ runner.os }}-test-mill-plugin-${{ env.cache-name }}-
40-
${{ runner.os }}-test-mill-plugin-
34+
4135
- name: Maven Clean Install
4236
env:
4337
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
4438
run: |
4539
./mvnw clean install -DskipTests -Dmaven.javadoc.skip=true
4640
41+
# This is needed because of differences in how Maven and Coursier download artifacts
42+
# Maven will only download the pom when the transitive dependency is not needed in the current projects compile classpath
43+
# whereas Coursier expects the artifact (jar) to be present in a Maven repository.
44+
- name: Clear m2 cache except openapitools (because otherwise coursier will fail to resolve artifacts where only poms are downloaded)
45+
run: |
46+
mv ~/.m2/repository/org/openapitools /tmp/openapitools-backup || true
47+
rm -rf ~/.m2/repository/*
48+
mkdir -p ~/.m2/repository/org
49+
mv /tmp/openapitools-backup ~/.m2/repository/org/openapitools || true
50+
4751
- name: Mill Example - Test Validation Command
4852
env:
4953
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}

0 commit comments

Comments
 (0)