fix(run): pin the JDWP port for Maven test forks (#2215) (#2268)

A Surefire/Failsafe fork started with suspend=y never reaches the console
with its "Listening for transport" line: surefire buffers the fork's
output until the tests run, and the tests wait for the debugger. The IDE
found no port, never attached, and Stop left an orphan debug session.

Pick a free port up front (new debug_free_port IPC), pass it to the
-Dmaven.surefire.debug/-Dmaven.failsafe.debug agent as
address=127.0.0.1:<port>, and attach right away — java-debug retries the
connect while the fork starts, so no output line is needed. A duplicated
line that does arrive later is deduplicated by port.
Цей коміт міститься в:
arookieofc authored and GitHub committed 2026-11-09 12:50:40 +08:00
1 джерело 92b527ab0e
коміт 0ccc1e687d
6 files changed
+49 -6

No files matched your search

+7
Переглянути файл
@@ -289,6 +289,13 @@ pub async fn debug_attachable_processes(state: State<'_, AppState>) -> IdeResult
ide_host::ops::debug::debug_attachable_processes(&state.host, "").await
}
/// A loopback port that is free right now, for a debug agent the launch line starts.
#[tauri::command]
#[specta::specta]
pub async fn debug_free_port(window: Window, state: State<'_, AppState>) -> IdeResult<u16> {
ide_host::ops::debug::debug_free_port(&state.host, window.label()).await
}
/// Remote JVM Debug in listen mode: waits (cancellable through `request`) for the remote
/// JVM to connect to `host:port`; returns the loopback port java-debug attaches to.
#[tauri::command]
+1
Переглянути файл
@@ -474,6 +474,7 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
debug::debug_set_data_breakpoints,
debug::debug_data_breakpoint_info,
debug::debug_attachable_processes,
debug::debug_free_port,
debug::debug_listen_for_jvm,
debug::debug_redefine_classes,
coverage::coverage_prepare,