From 8400fdc0fcf00e65ce3befa0273fa1fdb35fcb7c Mon Sep 17 00:00:00 2001 From: Jiaming <71547730+Jiaaming@users.noreply.github.com> Date: Tue, 30 Jul 2024 13:37:44 +0800 Subject: [PATCH] Fix: use import.gradle.java.home in prior (#1534) --- extension/src/server/serverUtil.ts | 9 +++++++-- extension/src/util/config.ts | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/extension/src/server/serverUtil.ts b/extension/src/server/serverUtil.ts index 6034627ab..c2746175a 100644 --- a/extension/src/server/serverUtil.ts +++ b/extension/src/server/serverUtil.ts @@ -1,4 +1,9 @@ -import { checkEnvJavaExecutable, findValidJavaHome, getRedHatJavaEmbeddedJRE } from "../util/config"; +import { + checkEnvJavaExecutable, + findValidJavaHome, + getConfigJavaImportGradleJavaHome, + getRedHatJavaEmbeddedJRE, +} from "../util/config"; export function getGradleServerCommand(): string { const platform = process.platform; @@ -16,7 +21,7 @@ export interface ProcessEnv { } export async function getGradleServerEnv(): Promise { - const javaHome = getRedHatJavaEmbeddedJRE() || (await findValidJavaHome()); + const javaHome = getConfigJavaImportGradleJavaHome() || getRedHatJavaEmbeddedJRE() || (await findValidJavaHome()); const env = { ...process.env }; if (javaHome) { Object.assign(env, { diff --git a/extension/src/util/config.ts b/extension/src/util/config.ts index f71cd6412..0e039d8a9 100644 --- a/extension/src/util/config.ts +++ b/extension/src/util/config.ts @@ -34,7 +34,7 @@ export function getJavaExecutablePathFromJavaHome(javaHome: string): string { } export async function findValidJavaHome(): Promise { - const javaHomeGetters = [getJdtlsConfigJavaHome, getConfigJavaHome, getConfigJavaImportGradleJavaHome]; + const javaHomeGetters = [getJdtlsConfigJavaHome, getConfigJavaHome]; let javaHome: string | undefined = undefined; let javaVersion = 0;