Fail on mismatched Maven toolchain ID counts - #1161
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8c821981-7b21-45fe-9463-5bb375d7dce4
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request tightens actions/setup-java validation around Maven toolchain IDs so misconfigured workflows fail early instead of silently falling back to generated defaults, aligning behavior with the documented one-to-one mapping expectation.
Changes:
- Add
validateToolchainIdsand invoke it before any JDK installation to enforce toolchain ID count matches configured Java versions (includingjava-version-filecounting as one version). - Update documentation and
action.ymlinput descriptions to reflect the new validation behavior. - Add regression tests for valid and invalid toolchain ID count scenarios.
Show a summary per file
| File | Description |
|---|---|
| src/toolchains.ts | Adds validateToolchainIds count validation logic. |
| src/setup-java.ts | Calls toolchain ID validation during input processing. |
| README.md | Documents the new toolchain ID count requirement. |
| docs/advanced-usage.md | Updates advanced usage guidance for multi-version toolchain IDs. |
| dist/setup/index.js | Updates bundled runtime to include the new validation behavior. |
| action.yml | Updates input description to document the stricter validation. |
| tests/toolchains.test.ts | Adds unit tests for validateToolchainIds. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 6/7 changed files
- Comments generated: 1
- Review effort level: Low
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8c821981-7b21-45fe-9463-5bb375d7dce4
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:
When custom Maven toolchain IDs do not map one-to-one to configured Java versions, setup-java currently discards them and silently generates defaults. This change validates the counts before any JDK installation, reports both counts on mismatch, and treats
java-version-fileas one configured version while preserving generated IDs when the input is omitted.The input documentation, regression tests, and bundled action runtime are updated with the new behavior.
Related issue:
Fixes: #1156
Check list:
npm run checklocally (format, lint, build, test) and all checks pass.