[Launching] automatically debug forked JVMs in Debug Maven build (#124) #471
+360
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is the in progress work to resolve issue #124 whose goal is to automatically attach a remote Java application debugger to VMs forked from a Maven build process, which is for example used for surefire tests.
The work is not yet in good shape but it is a proof of concept that (should) works for the following plug-ins,:
org.apache.maven.plugins:maven-surefire-plugin
org.eclipse.tycho:tycho-surefire-plugin
org.eclipse.tycho.extras:tycho-eclipserun-plugin
What's working already:
So if there is a break-point, for example in a test, the forked VM stops at that break point just like the VM was never forked.
If the Maven build is launched in
run
mode it behaves as usual and does not modify the mojos that fork VMs.What has to be improved:
DebugLaunchParticipant
is probably better placed in the calling code of the m2e.launching plug-in. Then it would not be necessary for the m2e.maven.runtime bundle to be a singleton so the extension-points are processed (even tough I wonder why M2E's Maven runtime components are not singletons.MavenConsoleLineTracker
does not set theIJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME
of the launched remote Java application correctly when variables are used (which at least I usually do) so source are not available then. But I will address that in a separate PR where I want to rework theMavenConsoleLineTracker
in general (it is almost complete).My main intention with this draft PR is to gather some early feedback, in general and especially about the definition of the debug-properties.
@laeubi you created the mentioned issue issued, @mickaelistria you might be interested too. What do you think?