Add set-default option

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 #560
This commit is contained in:
Guillaume Smet
2026-06-12 18:24:58 +02:00
committed by GitHub
parent 808209e61e
commit 9eb9a7c9b3
12 changed files with 282 additions and 12 deletions
+5
View File
@@ -28,6 +28,7 @@ async function run() {
constants.INPUT_CACHE_DEPENDENCY_PATH
);
const checkLatest = getBooleanInput(constants.INPUT_CHECK_LATEST, false);
const setDefault = getBooleanInput(constants.INPUT_SET_DEFAULT, true);
let toolchainIds = core.getMultilineInput(constants.INPUT_MVN_TOOLCHAIN_ID);
core.startGroup('Installed distributions');
@@ -44,6 +45,7 @@ async function run() {
architecture,
packageType,
checkLatest,
setDefault,
distributionName,
jdkFile,
toolchainIds
@@ -100,6 +102,7 @@ async function installVersion(
architecture,
packageType,
checkLatest,
setDefault,
toolchainIds
} = options;
@@ -107,6 +110,7 @@ async function installVersion(
architecture,
packageType,
checkLatest,
setDefault,
version
};
@@ -141,6 +145,7 @@ interface installerInputsOptions {
architecture: string;
packageType: string;
checkLatest: boolean;
setDefault: boolean;
distributionName: string;
jdkFile: string;
toolchainIds: Array<string>;