fix: invalidate maven cache on pom.xml changes#649
Merged
nookyo merged 1 commit intoNetcracker:mainfrom Mar 13, 2026
Merged
Conversation
borislavr
approved these changes
Mar 13, 2026
nookyo
approved these changes
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Summary
Problem: the current cache key depends only on the runner OS, so it is never invalidated when maven dependencies change. As a result, the same cache may be reused indefinitely even after pom.xml updates.
Proposed solution: include a hash of
pom.xmlfiles in the cache key so the cache is invalidated when the dependency configuration changes, while still allowing fallback restores via a prefix key.Trade-offs: existing caches in target repositories will not match the new key, so the first build after this change will not get a cache hit and will need to download all dependencies.
Issue
This ensures the maven cache stays aligned with the current dependency configuration. When dependencies change, a new cache is created, keeping the cache closer to the actual state and reducing the amount of dependencies that need to be downloaded during builds.
Breaking Change?
Scope / Project
Workflows