Debugger should allow user to specify launching cli command in launch.json #33
Copy link
Copy link
Closed
Description
Activity
Suggest configuring
preLaunchTaskto trigger themvnDebug tomcat7:runin launch.json.Jinbo Wang (@testforstephen), please see if this can address the problem. If so, we won't need to add
launchInTerminalnow.testforstephen commented
on Sep 21, 2017 ContributorAuthorMore actionsRome Li (@akaroml) Yes, use
preLaunchTaskcan fix the issue perfectly.testforstephen commented
on Sep 21, 2017 ContributorAuthorMore actionsAdd a new task in tasks.json:
"tasks": [ { "taskName": "mvnDebug", "type": "shell", "command": "mvnDebug tomcat7:run", "group": "build" } ]Then add
preLaunchTaskin launch.json:{ "type": "java", "name": "Debug (Attach)", "request": "attach", "hostName": "localhost", "port": 8000, "timeout": 30000, "sourcePaths": [ "${workspaceRoot}" ], "preLaunchTask": "mvnDebug" }Select the new debug configuration as default config and Click F5. It can launch spring mvc in debug mode.
Can we ask vscode to add an event like "postDebugTask" to let the user do some cleanup works?
The original issue can be resolved by adding preLaunchTask. It would be nicer if vscode provide an event to allow cleanups. But this issue can be closed for now.
In order to debug spring mvc projects with vscode-java-debug, user need run
mvnDebug tomcat7:runon cmd first, then configure attach options in launch.json.Actually debugger can integrate the launch command in launch.json. And use
launchInTerminalfeature to execute the launching command in VSCode integrated terminal automatically. Then debugger attaches to the debug port to start debugging.