Support inferring distribution from .java-version and .tool-versions files#1076
Closed
brunoborges with Copilot wants to merge 3 commits into
Closed
Support inferring distribution from .java-version and .tool-versions files#1076brunoborges with Copilot wants to merge 3 commits into
brunoborges with Copilot wants to merge 3 commits into
Conversation
Copilot
AI
changed the title
[WIP] Make distribution field optional in setup-java
Support inferring distribution from .java-version and .tool-versions files
Jul 7, 2026
Contributor
|
@copilot .java-version file format does not accept distribution |
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:
Makes the
distributioninput optional when a version file already names a distribution. Previously only.sdkmanrc(suffix, e.g.java=21.0.5-tem) could infer the distribution; this extends inference to jenv-style.java-versionand asdf-style.tool-versionsfiles using a distribution prefix.src/util.ts) —getVersionFromFileContentnow captures an optional distribution identifier from.java-versionand.tool-versions, in addition to the existing.sdkmanrcsuffix handling. Version extraction is unchanged.mapJavaVersionFileDistributionvalidates the identifier againstSUPPORTED_DISTRIBUTIONS(src/constants.ts), stripping arch suffixes (temurin64→temurin). Unsupported/generic prefixes (e.g.openjdk64) are ignored, falling back to thedistributioninput so existing behavior is preserved.README.md,action.yml, anddocs/advanced-usage.mdto describe prefix-based inference..java-version/.tool-versionsunit cases in__tests__/util.test.ts(including the hyphen-separator edge case) and an e2e job ine2e-versions.ymlthat installs with the distribution inferred and nodistributioninput.Note: when a file specifies a supported distribution, it takes precedence over the
distributioninput.Check list:
npm run checklocally (format, lint, build, test) and all checks pass.