From 6e297dc81defde6e59d22c639cf6d977a89c29e7 Mon Sep 17 00:00:00 2001 From: Alexander Koshevoy Date: Wed, 22 Oct 2025 21:29:18 +0200 Subject: [PATCH] =?UTF-8?q?[jps]=20IDEA-376790=20Do=20not=20fall=20back=20?= =?UTF-8?q?to=20IDE=20runtime=20JDK=20for=20non=E2=80=91local=20builds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stop using the local IDE runtime JDK as a fallback when the project builds remotely (Docker/SSH/WSL). This avoids launching the build with a JDK that cannot run on the target machine and prevents hard‑to‑diagnose failures. When no compatible remote JDK is found, we now fail fast. Existing local and WSL‑specific behavior remains unchanged. (cherry picked from commit 3e27c308520d3522572fdfc2ee57e4d6c4e2ab63) IJ-CR-179667 GitOrigin-RevId: a3958d861960083811dee737e11a7450009a5863 --- .../src/com/intellij/compiler/server/BuildManager.java | 7 ++++++- .../resources/messages/JavaCompilerBundle.properties | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java index 61d16ff604fe..f5014a8613a7 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java @@ -1188,7 +1188,12 @@ public final class BuildManager implements Disposable { .min(Map.Entry.comparingByValue()) .map(p -> Pair.create(p.getKey(), JavaSdkVersion.fromJavaVersion(p.getValue()))) .filter(p -> p.second != null) - .orElseGet(BuildManager::getIDERuntimeSdk); + .orElseGet(() -> { + if (canUseEel() && !EelPathUtils.isProjectLocal(project)) { + throw new IllegalStateException(JavaCompilerBundle.message("build.manager.launch.build.process.failed.to.find.compatible.jdk")); + } + return getIDERuntimeSdk(); + }); }); } diff --git a/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties b/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties index cc883d50bc0a..07173defb4bb 100644 --- a/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties +++ b/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties @@ -360,4 +360,5 @@ error.clean.state.rebuild.not.possible=Complete cleaning of build system data is build.manager.launch.build.process.failed.to.copy.parameter=Failed to copy parameter {0} build.manager.launch.build.process.failed.to.copy.external.project.configuration=Failed to copy external project configuration -build.manager.launch.build.process.failed.to.copy.additional.plugin=Failed to copy additional plugin \ No newline at end of file +build.manager.launch.build.process.failed.to.copy.additional.plugin=Failed to copy additional plugin +build.manager.launch.build.process.failed.to.find.compatible.jdk=Failed to find compatible JDK \ No newline at end of file