mirror of
https://github.com/actions/setup-java.git
synced 2026-06-23 16:20:28 +03:00
Dedupe setJavaDefault and document multi-version/toolchain behavior
- 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>
This commit is contained in:
@@ -310,16 +310,9 @@ export abstract class JavaBase {
|
||||
}
|
||||
|
||||
protected setJavaDefault(version: string, toolPath: string) {
|
||||
const majorVersion = version.split('.')[0];
|
||||
core.exportVariable('JAVA_HOME', toolPath);
|
||||
core.addPath(path.join(toolPath, 'bin'));
|
||||
core.setOutput('distribution', this.distribution);
|
||||
core.setOutput('path', toolPath);
|
||||
core.setOutput('version', version);
|
||||
core.exportVariable(
|
||||
`JAVA_HOME_${majorVersion}_${this.architecture.toUpperCase()}`,
|
||||
toolPath
|
||||
);
|
||||
this.setJavaEnvironment(version, toolPath);
|
||||
}
|
||||
|
||||
protected setJavaEnvironment(version: string, toolPath: string) {
|
||||
|
||||
Reference in New Issue
Block a user