Skip to content

Commit 041488b

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

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

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

Lines changed: 15 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,25 @@ 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. When Coursier encounters a
44+
# artifact folder with a pom it considers the artifact to be available and will then crash when the jar is missing.
45+
- name: Clear m2 cache except openapitools (because otherwise coursier will fail to resolve artifacts where only poms are downloaded)
46+
run: |
47+
mv ~/.m2/repository/org/openapitools /tmp/openapitools-backup || true
48+
rm -rf ~/.m2/repository/*
49+
mkdir -p ~/.m2/repository/org
50+
mv /tmp/openapitools-backup ~/.m2/repository/org/openapitools || true
51+
4752
- name: Mill Example - Test Validation Command
4853
env:
4954
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}

modules/openapi-generator-mill-plugin/example/build.mill

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import org.openapitools.generator.mill.OpenApiModule
1818
object `package` extends JavaModule with MavenModule with OpenApiModule {
1919

2020
override def mvnDeps = Seq(
21-
mvn"jakarta.platform:jakarta.jakartaee-api:11.0.0",
21+
mvn"jakarta.platform:jakarta.jakartaee-api:10.0.0",
2222
mvn"com.fasterxml.jackson.core:jackson-databind:2.20.0",
2323
mvn"org.openapitools:jackson-databind-nullable:0.2.8"
2424
)

0 commit comments

Comments
 (0)