Body:
Summary
MavenConsoleLineTracker#launchRemoteJavaApp invokes DebugUITools.launch(...) from a non-UI thread (a ConsolePatternMatcher$MatchJob worker). DebugUITools.launch eventually calls Display.getShells(), which enforces UI-thread access, so the launch fails with SWTException: Invalid thread access. The Maven build itself succeeds, but the auto-attach of the remote Java debugger for a forked JVM (e.g. Surefire <debug>true</debug>, mvnDebug, or -Dmaven.surefire.debug) is aborted and an error is logged.
Environment
- Eclipse IDE for Enterprise Java and Web Developers 4.40.0.20260604-0652 (2026-06)
- Product:
org.eclipse.epp.package.jee.product
- OS: Windows 10/11 x86_64 (
win32/win32/x86_64), locale en_GB
- Java: 21.0.12 (Eclipse Adoptium)
- m2e:
org.eclipse.m2e.feature.feature.group 2.10.200.20260602-0749
org.eclipse.m2e.sdk.feature.feature.group 2.11.1.20260602-0814
org.eclipse.m2e.pde.feature.feature.group 2.3.700.20260602-0814
org.eclipse.m2e.lemminx.feature.feature.group 2.6.101.20250727-0612
org.eclipse.m2e.logback.feature.feature.group 2.7.200.20251018-1026
- Workspace:
file:/S:/_workspaces/distribution/
Steps to reproduce
- In Eclipse, run a Maven build that forks a JVM with a debug port (e.g. Roomlynx service tests with Surefire
<debug>true</debug>, mvnDebug, or -Dmaven.surefire.debug).
- Wait for the Maven console to print the line recognized by
MavenConsoleLineTracker (e.g. Listening for transport dt_socket at address: <port>).
launchRemoteJavaApp is called from the ConsolePatternMatcher$MatchJob worker thread.
Expected result
A remote Java application debug configuration is created and launched; Eclipse attaches the debugger to the forked JVM.
Actual result
The launch is aborted and an SWTException: Invalid thread access error is logged. The Maven build continues, but the debugger does not attach.
Stack trace
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4922)
at org.eclipse.swt.SWT.error(SWT.java:4837)
at org.eclipse.swt.SWT.error(SWT.java:4808)
at org.eclipse.swt.widgets.Display.error(Display.java:1324)
at org.eclipse.swt.widgets.Display.checkDevice(Display.java:875)
at org.eclipse.swt.widgets.Display.getShells(Display.java:2318)
at org.eclipse.ui.internal.progress.ProgressManagerUtil.getModalShellExcluding(ProgressManagerUtil.java:410)
...
at org.eclipse.debug.ui.DebugUITools.launch(DebugUITools.java:...)
at org.eclipse.m2e.internal.launch.MavenConsoleLineTracker.launchRemoteJavaApp(MavenConsoleLineTracker.java:332)
at org.eclipse.m2e.internal.launch.MavenConsoleLineTracker.lineAppended(MavenConsoleLineTracker.java:156)
at org.eclipse.debug.internal.ui.views.console.ConsolePatternMatcher$MatchJob.run(ConsolePatternMatcher.java:...)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:...)
Possible fix
Wrap the DebugUITools.launch(...) call in Display.getDefault().asyncExec(...) (or otherwise ensure it runs on the SWT UI thread) before invoking any UI/debug-launch API.
Body:
Summary
MavenConsoleLineTracker#launchRemoteJavaAppinvokesDebugUITools.launch(...)from a non-UI thread (aConsolePatternMatcher$MatchJobworker).DebugUITools.launcheventually callsDisplay.getShells(), which enforces UI-thread access, so the launch fails withSWTException: Invalid thread access. The Maven build itself succeeds, but the auto-attach of the remote Java debugger for a forked JVM (e.g. Surefire<debug>true</debug>,mvnDebug, or-Dmaven.surefire.debug) is aborted and an error is logged.Environment
org.eclipse.epp.package.jee.productwin32/win32/x86_64), localeen_GBorg.eclipse.m2e.feature.feature.group2.10.200.20260602-0749org.eclipse.m2e.sdk.feature.feature.group2.11.1.20260602-0814org.eclipse.m2e.pde.feature.feature.group2.3.700.20260602-0814org.eclipse.m2e.lemminx.feature.feature.group2.6.101.20250727-0612org.eclipse.m2e.logback.feature.feature.group2.7.200.20251018-1026file:/S:/_workspaces/distribution/Steps to reproduce
<debug>true</debug>,mvnDebug, or-Dmaven.surefire.debug).MavenConsoleLineTracker(e.g.Listening for transport dt_socket at address: <port>).launchRemoteJavaAppis called from theConsolePatternMatcher$MatchJobworker thread.Expected result
A remote Java application debug configuration is created and launched; Eclipse attaches the debugger to the forked JVM.
Actual result
The launch is aborted and an
SWTException: Invalid thread accesserror is logged. The Maven build continues, but the debugger does not attach.Stack trace
Possible fix
Wrap the
DebugUITools.launch(...)call inDisplay.getDefault().asyncExec(...)(or otherwise ensure it runs on the SWT UI thread) before invoking any UI/debug-launch API.