Skip to content

Debugger should allow user to specify launching cli command in launch.json #33

Description

In order to debug spring mvc projects with vscode-java-debug, user need run mvnDebug tomcat7:run on cmd first, then configure attach options in launch.json.
Actually debugger can integrate the launch command in launch.json. And use launchInTerminal feature to execute the launching command in VSCode integrated terminal automatically. Then debugger attaches to the debug port to start debugging.

Activity

  1. akaroml commented on Sep 21, 2017

    @akaroml
    Member

    Suggest configuring preLaunchTask to trigger the mvnDebug tomcat7:run in launch.json.

    Jinbo Wang (@testforstephen), please see if this can address the problem. If so, we won't need to add launchInTerminal now.

  2. testforstephen commented on Sep 21, 2017

    @testforstephen
    ContributorAuthor

    Rome Li (@akaroml) Yes, use preLaunchTask can fix the issue perfectly.

  3. testforstephen commented on Sep 21, 2017

    @testforstephen
    ContributorAuthor

    Add a new task in tasks.json:

        "tasks": [
            {
                "taskName": "mvnDebug",
                "type": "shell",
                "command": "mvnDebug tomcat7:run",
                "group": "build"
            }
        ]
    

    Then add preLaunchTask in 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.

  4. akaroml commented on Sep 22, 2017

    @akaroml
    Member

    Can we ask vscode to add an event like "postDebugTask" to let the user do some cleanup works?

  5. added this to the 0.2.0 milestone on Sep 22, 2017
  6. akaroml commented on Oct 26, 2017

    @akaroml
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions