From 04a13ff5e29f72d2396d9ec8b982df643a152982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Vav=C5=99=C3=ADk?= Date: Sun, 16 Oct 2022 12:54:04 +0200 Subject: [PATCH] Do not check if debug port can be used in DEV mode on restart fixes #28187 --- .../deployment/dev/QuarkusDevModeLauncher.java | 4 ++++ .../maven/src/main/java/io/quarkus/maven/DevMojo.java | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/QuarkusDevModeLauncher.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/QuarkusDevModeLauncher.java index a6140046945b4b..ff6c918d803eee 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/QuarkusDevModeLauncher.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/QuarkusDevModeLauncher.java @@ -494,6 +494,10 @@ public List args() { return args; } + public Boolean getDebugPortOk() { + return debugPortOk; + } + protected abstract boolean isDebugEnabled(); protected void debug(Object msg, Object... args) { diff --git a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java index 0d300ecc92a9dd..181b505645e49b 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -447,7 +447,7 @@ public void execute() throws MojoFailureException, MojoExecutionException { try { triggerCompile(false, false); triggerCompile(true, false); - newRunner = new DevModeRunner(); + newRunner = new DevModeRunner(runner.launcher.getDebugPortOk()); } catch (Exception e) { getLog().info("Could not load changed pom.xml file, changes not applied", e); continue; @@ -907,7 +907,11 @@ private class DevModeRunner { private Process process; private DevModeRunner() throws Exception { - launcher = newLauncher(); + launcher = newLauncher(null); + } + + private DevModeRunner(Boolean debugPortOk) throws Exception { + launcher = newLauncher(debugPortOk); } Collection pomFiles() { @@ -961,7 +965,7 @@ void stop() throws InterruptedException { } } - private QuarkusDevModeLauncher newLauncher() throws Exception { + private QuarkusDevModeLauncher newLauncher(Boolean debugPortOk) throws Exception { String java = null; // See if a toolchain is configured if (toolchainManager != null) { @@ -980,6 +984,7 @@ private QuarkusDevModeLauncher newLauncher() throws Exception { .debug(debug) .debugHost(debugHost) .debugPort(debugPort) + .debugPortOk(debugPortOk) .deleteDevJar(deleteDevJar); setJvmArgs(builder);