Problem
The Validate java quickstart workflow (.github/workflows/validate_java_quickstarts.yaml)
currently re-downloads all Maven dependencies on every run.
Looking at the repo, there are ~30 pom.xml files spread across state_management/,
jobs/, service_invocation/, configuration/, workflows/ and tutorials/workflow/.
The validation step iterates over each building block and runs make validate (which
ultimately invokes Maven), so the same artifacts (Dapr SDK, Spring Boot, JUnit,
Testcontainers, etc.) are fetched from Maven Central many times per job — and again
on every PR / push.
The current setup-java step does not enable any cache:
- name: Set up OpenJDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 17
Proposal
Enable Maven dependency caching in the Java validation workflow. Two complementary
changes:
1. Enable built-in Maven cache on setup-java
Upgrade the action and turn on the built-in cache, which hashes all **/pom.xml
files automatically:
- name: Set up OpenJDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'maven'
This already covers the majority of the speedup with a one-line change.
2. (Optional) Add restore-keys fallback via actions/cache@v4
If we want partial cache restoration when a single pom.xml changes (common in PRs
that touch one quickstart), we can use actions/cache directly with a restore-keys
fallback:
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
Side cleanup (same PR)
While touching this file, also:
- Bump
actions/checkout@v2 → @v4
- Replace deprecated
distribution: 'adopt' with 'temurin'
Expected impact
- Significantly faster Java validation runs on warm cache (most artifacts served
from ~/.m2/repository instead of Maven Central).
- Less load on Maven Central from CI.
- No behavior change in what gets validated.
Problem
The
Validate java quickstartworkflow (.github/workflows/validate_java_quickstarts.yaml)currently re-downloads all Maven dependencies on every run.
Looking at the repo, there are ~30
pom.xmlfiles spread acrossstate_management/,jobs/,service_invocation/,configuration/,workflows/andtutorials/workflow/.The validation step iterates over each building block and runs
make validate(whichultimately invokes Maven), so the same artifacts (Dapr SDK, Spring Boot, JUnit,
Testcontainers, etc.) are fetched from Maven Central many times per job — and again
on every PR / push.
The current
setup-javastep does not enable any cache:Proposal
Enable Maven dependency caching in the Java validation workflow. Two complementary
changes:
1. Enable built-in Maven cache on
setup-javaUpgrade the action and turn on the built-in cache, which hashes all
**/pom.xmlfiles automatically:
This already covers the majority of the speedup with a one-line change.
2. (Optional) Add
restore-keysfallback viaactions/cache@v4If we want partial cache restoration when a single
pom.xmlchanges (common in PRsthat touch one quickstart), we can use
actions/cachedirectly with arestore-keysfallback:
Side cleanup (same PR)
While touching this file, also:
actions/checkout@v2→@v4distribution: 'adopt'with'temurin'Expected impact
from
~/.m2/repositoryinstead of Maven Central).