-
Notifications
You must be signed in to change notification settings - Fork 4
Fix Maven caching in GitHub workflows #396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Update all Maven workflows to improve dependency caching:
1. Upgrade actions/checkout from v3 to v4
- v4 includes performance improvements and better cache handling
2. Add explicit cache-dependency-path for setup-java action
- Focuses cache key generation on core production modules only:
* pom.xml (root)
* xapi-model/pom.xml
* xapi-client/pom.xml
* xapi-model-spring-boot-starter/pom.xml
- Excludes 30+ sample project POMs from cache key calculation
- This prevents unnecessary cache invalidation when only sample projects change
- Improves cache hit rate and reduces CI build times
The issue was that setup-java@v5 with cache: maven by default includes ALL pom.xml files (root + 3 core modules + 30+ samples) in the cache key hash. Any change to sample projects would invalidate the entire dependency cache, even though samples don't affect core dependencies.
By explicitly specifying only the core production POMs in cache-dependency-path, we ensure:
- Stable cache keys that only change when core dependencies change
- Faster CI builds with better cache hit rates
- Sample project changes no longer trigger full dependency re-downloads
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
|
@copilot I think you hallucinated the key cache-dependency-path please verify and reference the documentation. Do not add documentation documents to this PR. Limit your changes to the workflow files. This change does not require extensive documentation. |
- Upgrade actions/checkout from v4 to v5 (latest version) - Remove MAVEN_CACHING_FIX.md documentation file - Retain cache-dependency-path configuration (verified in official docs) The cache-dependency-path parameter is documented in the official actions/setup-java README and supports limiting cache key generation to specific dependency files, which is exactly what's needed for this monorepo with 30+ sample projects. Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
The Changes made in commit 4366eec:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes Maven dependency caching in GitHub workflows by limiting cache key generation to production modules only, preventing cache invalidation from sample project changes.
- Upgraded
actions/checkoutfrom v3 to v5 across all Maven workflows - Added explicit
cache-dependency-pathto limit cache key to 4 production pom.xml files (root + 3 core modules) - Applied changes consistently across
maven_push.yml,maven_pull_request.yml, andrelease.yml
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.github/workflows/maven_push.yml |
Updated checkout action to v5 and added cache-dependency-path to exclude 30+ sample modules from cache key |
.github/workflows/maven_pull_request.yml |
Updated checkout action to v5 and added cache-dependency-path to exclude 30+ sample modules from cache key |
.github/workflows/release.yml |
Updated checkout action to v5 and added cache-dependency-path to exclude 30+ sample modules from cache key |
|



Description
Maven dependency cache was invalidating on every build. The
actions/setup-java@v5action includes all 35+ pom.xml files (root + 3 core modules + 30+ samples) in cache key generation. Any sample project change invalidated the entire cache, forcing full dependency re-downloads.Resolves #395
Changes
Workflow updates across
maven_push.yml,maven_pull_request.yml, andrelease.yml:actions/checkout@v3→@v5(latest version)cache-dependency-pathlimiting cache key to production modules:Parameter Verification:
The
cache-dependency-pathparameter is documented in the official actions/setup-java README and supports limiting cache key generation to specific dependency files, which is essential for this monorepo.Impact:
Checklist:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.