Skip to content

feat: add .mvn/extensions.xml to Maven cache key pattern#1041

Open
Copilot wants to merge 5 commits into
mainfrom
copilot/support-caching-maven-plugin-dependencies
Open

feat: add .mvn/extensions.xml to Maven cache key pattern#1041
Copilot wants to merge 5 commits into
mainfrom
copilot/support-caching-maven-plugin-dependencies

Conversation

Copilot AI commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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.xml to the Maven cache pattern array alongside **/pom.xml and **/.mvn/wrapper/maven-wrapper.properties
  • README.md — Update Maven cache key hash file list to include **/.mvn/extensions.xml
  • __tests__/cache.test.ts — Update existing pattern expectations; add test case for extensions.xml as sole matching file

The Maven cache key hash is now based on:

**/pom.xml
**/.mvn/wrapper/maven-wrapper.properties
**/.mvn/extensions.xml   ← new

Related issue:
#990

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

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
Copilot AI requested a review from brunoborges June 22, 2026 19:24
@brunoborges brunoborges marked this pull request as ready for review June 22, 2026 20:18
@brunoborges brunoborges requested a review from a team as a code owner June 22, 2026 20:18
Copilot AI review requested due to automatic review settings June 22, 2026 20:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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.xml to 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.xml as 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 thread __tests__/cache.test.ts Outdated
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`
);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 47340fb: the test name now includes extensions.xml so it matches the current Maven hash pattern set.

@brunoborges brunoborges added feature request New feature or request to improve the current logic cache Dependency/tool cache behavior and performance maven Maven settings, toolchains, and publishing auth labels Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cache Dependency/tool cache behavior and performance feature request New feature or request to improve the current logic maven Maven settings, toolchains, and publishing auth

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants