Skip to content

Add a "toolchains-only" install mode (layered on the set-default primitive) #1047

Description

@brunoborges

Add a "toolchains-only" install mode (layered on the set-default primitive)

Background

PR #1017 introduces a set-default input: when set-default: false, the action installs a JDK without updating JAVA_HOME / PATH (while still exporting JAVA_HOME_<major>_<arch>). That cleanly covers the "don't make this JDK the environment default" use case (issue #560).

The earlier PR #553 (issue #552) aimed at a broader, Maven-centric goal that partially overlaps with set-default but also contains a piece that set-default does not cover. This issue captures that remaining gap so it can be built on top of the set-default primitive rather than as a competing implementation.

The gap not covered by set-default

set-default: false controls the environment (JAVA_HOME / PATH). It does not, on its own, add the installed JDK as a Maven toolchain entry. The use case from #552 / #553 is:

Install a JDK and register it only as a Maven toolchain (~/.m2/toolchains.xml) — without touching JAVA_HOME, PATH, or settings.xml.

This is useful when a workflow needs an additional JDK available to Maven's maven-toolchains-plugin (e.g. compiling/running a module against a specific JDK) while leaving the workflow's primary Java environment untouched.

Proposed scope (narrowed)

Add a focused input — e.g. add-toolchain-only (name TBD) — that, when true:

  • Adds/updates the JDK entry in toolchains.xml (existing toolchains logic).
  • Implies set-default: false semantics (does not update JAVA_HOME / PATH) unless the user explicitly opts back in.
  • Does not modify settings.xml (no overwrite-settings side effects) unless explicitly requested.
  • Still exports JAVA_HOME_<major>_<arch> (consistent with set-default: false).

Explicitly out of scope (now handled by #1017):

  • General JAVA_HOME / PATH skipping — use set-default: false.

Relationship / dependencies

Notes

PR #553 also proposed update-env-javahome / update-env-path as separate booleans; those are intentionally not carried forward — set-default from #1017 is the single, cleaner knob for that behavior. This issue deliberately narrows the remaining work to just the toolchains.xml-only capability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or request to improve the current logicmavenMaven settings, toolchains, and publishing auth

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions