Skip to content

Commit efba580

Browse files
committed
Simplify using maven cache from setup-java
1 parent 104fb48 commit efba580

File tree

3 files changed

+17
-25
lines changed

3 files changed

+17
-25
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,10 @@ jobs:
4242
with:
4343
distribution: 'temurin'
4444
java-version: '11'
45-
- uses: actions/cache@v4
46-
with:
47-
key: maven-${{ hashFiles('**/pom.xml') }}
48-
restore-keys: maven-
49-
path: .m2/repository
50-
enableCrossOsArchive: true
45+
cache: 'maven'
5146
- name: Build with Maven
5247
run: |
5348
./mvnw --show-version --errors --batch-mode \
54-
-Dmaven.repo.local=.m2/repository \
5549
verify
5650
- uses: actions/upload-artifact@v4
5751
with:

.github/workflows/publish-release.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ jobs:
3333
- uses: actions/checkout@v4
3434
with:
3535
ref: ${{ github.event.workflow_run.head_branch }}
36+
- uses: actions/setup-java@v4
37+
with:
38+
distribution: 'temurin'
39+
java-version: '11'
40+
cache: 'maven'
3641
- name: Determine Version
3742
id: version
3843
run: |
@@ -63,24 +68,18 @@ jobs:
6368
with:
6469
distribution: 'temurin'
6570
java-version: '11'
71+
cache: 'maven'
6672
server-id: ossrh
6773
server-username: MAVEN_USERNAME
6874
server-password: MAVEN_PASSWORD
6975
gpg-passphrase: MAVEN_GPG_PASSPHRASE
7076
gpg-private-key: ${{ secrets.PMD_CI_GPG_PRIVATE_KEY }}
71-
- uses: actions/cache@v4
72-
with:
73-
key: maven-${{ hashFiles('**/pom.xml') }}
74-
restore-keys: maven-
75-
path: .m2/repository
76-
enableCrossOsArchive: true
7777
- name: Build and Publish
7878
env:
7979
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
8080
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
8181
MAVEN_GPG_PASSPHRASE: ${{ secrets.PMD_CI_GPG_PASSPHRASE }}
8282
run: |
8383
./mvnw --show-version --errors --batch-mode \
84-
-Dmaven.repo.local=.m2/repository \
85-
deploy \
86-
-Psign
84+
-Psign \
85+
deploy

.github/workflows/publish-snapshot.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ jobs:
3333
- uses: actions/checkout@v4
3434
with:
3535
ref: main
36+
- uses: actions/setup-java@v4
37+
with:
38+
distribution: 'temurin'
39+
java-version: '11'
40+
cache: 'maven'
3641
- name: Determine Version
3742
id: version
3843
run: |
@@ -63,24 +68,18 @@ jobs:
6368
with:
6469
distribution: 'temurin'
6570
java-version: '11'
71+
cache: 'maven'
6672
server-id: ossrh
6773
server-username: MAVEN_USERNAME
6874
server-password: MAVEN_PASSWORD
6975
gpg-passphrase: MAVEN_GPG_PASSPHRASE
7076
gpg-private-key: ${{ secrets.PMD_CI_GPG_PRIVATE_KEY }}
71-
- uses: actions/cache@v4
72-
with:
73-
key: maven-${{ hashFiles('**/pom.xml') }}
74-
restore-keys: maven-
75-
path: .m2/repository
76-
enableCrossOsArchive: true
7777
- name: Build and Publish
7878
env:
7979
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
8080
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
8181
MAVEN_GPG_PASSPHRASE: ${{ secrets.PMD_CI_GPG_PASSPHRASE }}
8282
run: |
8383
./mvnw --show-version --errors --batch-mode \
84-
-Dmaven.repo.local=.m2/repository \
85-
deploy \
86-
-Psign
84+
-Psign \
85+
deploy

0 commit comments

Comments
 (0)