feat: add .mvn/extensions.xml to Maven cache key pattern#1041
Open
Copilot wants to merge 5 commits into
Open
Conversation
Closes #990 Maven build extensions declared in `.mvn/extensions.xml` can introduce additional plugin dependencies (e.g. lifecycle participants, custom packaging types). Including this file in the cache key hash ensures that changes to extensions — which affect what plugin JARs Maven downloads — properly invalidate the cache, preventing stale caches from missing newly-required plugin dependencies. Changes: - src/cache.ts: add `**/.mvn/extensions.xml` to Maven pattern array - __tests__/cache.test.ts: update pattern expectations; add new test - README.md: document the new file in the Maven cache key hash list
Copilot
AI
changed the title
[WIP] Add support for caching Maven plugin dependencies in setup-java
feat: add .mvn/extensions.xml to Maven cache key pattern
Jun 22, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Maven dependency cache key inputs so that changes to .mvn/extensions.xml (Maven build extensions) invalidate the cache, preventing restores of stale ~/.m2/repository content when extensions change.
Changes:
- Add
**/.mvn/extensions.xmlto the Maven cache key hash pattern list in the caching implementation. - Update README documentation to reflect the new Maven hash inputs.
- Update and extend unit tests to cover
extensions.xmlas a matching input.
Show a summary per file
| File | Description |
|---|---|
src/cache.ts |
Adds **/.mvn/extensions.xml to Maven cache key hashing patterns. |
README.md |
Documents **/.mvn/extensions.xml as part of the Maven cache key hash inputs. |
__tests__/cache.test.ts |
Updates Maven pattern expectations and adds a test for extensions.xml as the only matching file. |
dist/setup/index.js |
Regenerated bundle includes Maven pattern update, but also includes large unrelated bundled-dependency changes. |
dist/cleanup/index.js |
Regenerated bundle includes Maven pattern update, but also includes large unrelated bundled-dependency changes. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/5 changed files
- Comments generated: 1
Comment on lines
99
to
104
| @@ -100,7 +100,7 @@ describe('dependency cache', () => { | |||
| await expect(restore('maven', '')).rejects.toThrow( | |||
| `No file in ${projectRoot( | |||
| workspace | |||
| )} matched to [**/pom.xml,**/.mvn/wrapper/maven-wrapper.properties], make sure you have checked out the target repository` | |||
| )} matched to [**/pom.xml,**/.mvn/wrapper/maven-wrapper.properties,**/.mvn/extensions.xml], make sure you have checked out the target repository` | |||
| ); | |||
Contributor
Author
There was a problem hiding this comment.
Updated in 47340fb: the test name now includes extensions.xml so it matches the current Maven hash pattern set.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description:
Maven build extensions declared in
.mvn/extensions.xml(lifecycle participants, custom packaging types, etc.) introduce additional plugin JARs that Maven downloads at build time. These were invisible to the cache key, so changes to extensions would hit the same cache key and restore a stale/incomplete~/.m2/repository, causing repeated plugin dependency downloads.Changes:
src/cache.ts— Add**/.mvn/extensions.xmlto the Maven cachepatternarray alongside**/pom.xmland**/.mvn/wrapper/maven-wrapper.propertiesREADME.md— Update Maven cache key hash file list to include**/.mvn/extensions.xml__tests__/cache.test.ts— Update existing pattern expectations; add test case forextensions.xmlas sole matching fileThe Maven cache key hash is now based on:
Related issue:
#990
Check list: