-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for mvnDebug #49
Comments
I think it's ok to use |
I found that this doesn't work well as when you do things like compile it waits for a debugger to be connected. I wonder if a debug extension is needed to solve this properly? |
@chriscamplejohn The feature should be provided in a new extension named as |
I'm also interested in this feature. |
@dvirtz I'm also interested in the user experience you'd like to have. For the
Please take a look whether this is the expected behavior. |
@Eskibear The issue I had when doing that is whenever you execute any maven operation it then waits for a debugger to connect which is a pain. You may as well do the manual step of starting the maven debug session in a shell and then connect with normal java debugging. |
Agree. But I'm just not sure whether we should put this feature in this extension, and how to implement. As you might know, currently this extension doesn't depend on any other extension. If you want it to start a debug session for you automatically, then we have to explicitly add "Debugger for Java" to dependencies. I'm not sure if it's a right thing to do. A workaround for your issueWhile we discuss about this, for your use case, you might have a try on "preLaunchTask". E.g. .vscode/tasks.json {
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "myMavenDebugCommand",
"type": "shell",
"command": "mvnDebug spring-boot:run",
"group": "build"
}
]
} An "attach" config: {
"type": "java",
"name": "Debug (Attach)",
"request": "attach",
"hostName": "localhost",
"port": 8008,
"preLaunchTask": "myMavenDebugCommand" // <--It will be executed first.
} Then all you need to do is running the "attach" config with F5. |
I will give this a go, but from memory the issue was that it was not reliable. The pre-task would execute, but after execution maven debug was not always started, it was only in the process of starting. This means that attach fails sometimes (sporadically). The difference between attach and debug is that attach only tries once where as debug waits for the process being debugged to become ready - so it will keep trying to attach. |
@Eskibear Can't you make an optional command which will be enabled only if Using
|
@dvirtz Do you set the right port 8000 in the "attach" config? About the mvnDebug support, adding an optional command for mvnDebug to launch a debug session seems a little bit casual in design, and the maven extension actually has no knowledge of the listening port(if user has modified it). |
I did but it seems to wait for the task completion before entering debug.
the terminal is closed right after starting the task and the task terminates. |
I just find a similar issue microsoft/vscode-java-debug#120 |
Thanks. I hope you'll raise the priority of this. |
If the preLaunchTask points to a server mode or background task, you should use problemMatcher filter to tell VSCode it's ready. Then the Java debugger has the chance to attach to the mvnDebug port. Below is the task.json spring-boot sample:
And launch.json sample:
|
That works. Thanks!
…On Thu, 30 Aug 2018 at 13:22, Jinbo Wang ***@***.***> wrote:
If the preLaunchTask points to a server mode or background task, you
should use problemMatcher filter to tell VSCode it's ready. Then the Java
debugger has the chance to attach to the mvnDebug port.
Below is the task.json spring-boot sample:
{
"label": "mvnDebug",
"type": "shell",
"command": "mvnDebug spring-boot:run",
"isBackground": true,
"problemMatcher": [{
"pattern": [{
"regexp": "\\b\\B",
"file": 1,
"location": 2,
"message": 3
}],
"background": {
"activeOnStart": true,
"beginsPattern": "^.*Preparing to execute Maven in debug mode.*",
"endsPattern": "^.*Listening for transport dt_socket at address.*"
}
}]
}
And launch.json sample:
{
"type": "java",
"name": "Debug (Attach)",
"request": "attach",
"hostName": "localhost",
"port": "8000",
"preLaunchTask": "mvnDebug"
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#49 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHTojYij5EVQbvcmKikd5J5KAlyssObkks5uV7zrgaJpZM4TqOfm>
.
|
Since there's a workaround for it, I'm closing it. Currently, there's no feasible approach to provide such feature in this extension. Anyone who has a good solution please re-open it to continue the discussion. |
Hi,
Is there any support for using mvnDebug instead of mvn? At present I have just added the following setting to use mvnDebug from my PATH.
"maven.executable.path": "mvnDebug"
Not sure if there is a downside of this?
Use case is that I want to be able to use the jetty-maven-plugin and debug my servlet code. So I run mvnDebug jetty:run and then I can attach the vscode debugger.
Thanks
Chris
The text was updated successfully, but these errors were encountered: