Skip to content

feat: Add set-default option#1017

Open
gsmet wants to merge 4 commits into
actions:mainfrom
gsmet:set-default
Open

feat: Add set-default option#1017
gsmet wants to merge 4 commits into
actions:mainfrom
gsmet:set-default

Conversation

@gsmet

@gsmet gsmet commented Jun 12, 2026

Copy link
Copy Markdown

Description:

Add a set-default option allowing to install an additional JDK without making it the default one.

I have wanted this for quite a long time as I'm running custom GitHub Actions with Java, which might require a specific JDK and I don't want to pollute the JDK that is used by the overall workflow calling the action.
And I'm apparently not alone as there was a preexisting issue.

Related issue:

Fixes #560

Check list:

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

This option allows to install an additional JDK without making it the
default one.

I have wanted this for quite a long time as I'm running custom GitHub
Actions with Java, which might require a specific JDK and I don't want
to pollute the JDK that is used by the overall workflow calling the
action.
And I'm apparently not alone as there was a preexisting issue.

Fixes actions#560
@gsmet gsmet requested a review from a team as a code owner June 12, 2026 16:28
@brunoborges brunoborges added the feature request New feature or request to improve the current logic label Jun 22, 2026
brunoborges and others added 2 commits June 22, 2026 16:44
- Refactor setJavaDefault to delegate shared output/env logic to
  setJavaEnvironment, avoiding duplication between the two.
- Document that set-default applies to all JDKs in a multiline
  java-version, and that installed JDKs remain registered in Maven
  toolchains regardless of set-default.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@brunoborges

Copy link
Copy Markdown
Contributor

Cross-linking for coordination: this set-default option overlaps conceptually with the older PR #553 (issue #552), which also lets you install a JDK without mutating JAVA_HOME/PATH.

set-default: false here is effectively a cleaner, single-flag expression of #553's update-env-javahome: false + update-env-path: false (both also deliberately preserve JAVA_HOME_<major>_<arch>). We're treating set-default as the canonical primitive for "don't make this JDK the default."

The one piece #553 covered that this PR does not is a Maven toolchains-only install (register the JDK in toolchains.xml only). That remaining gap has been split out into #1047, scoped to build on top of set-default rather than re-implement env skipping. PR #553 is being closed in favor of this PR + #1047.

No change requested here — just establishing the lineage: #560 (this PR) and #552#1047.

@brunoborges brunoborges changed the title Add set-default option feat: Add set-default option Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request New feature or request to improve the current logic

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Input property that would configure if the JDK should be configured as default or not

2 participants