★ wanayoo — archive 1999 https://github.com/microsoft/vscode-java-debug/issues/33Nouvelle recherche | Portail wanayoo
Skip to content
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

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

Closed
testforstephen opened this issue Sep 21, 2017 · 5 comments
Closed
Assignees
Labels
Milestone

Comments

@testforstephen
Copy link
Contributor

@testforstephen testforstephen commented Sep 21, 2017

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.

@akaroml
Copy link
Member

@akaroml akaroml commented Sep 21, 2017 •

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

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

@testforstephen
Copy link
Contributor Author

@testforstephen testforstephen commented Sep 21, 2017

@akaroml Yes, use preLaunchTask can fix the issue perfectly.

@testforstephen
Copy link
Contributor Author

@testforstephen testforstephen commented Sep 21, 2017 •

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.

@akaroml
Copy link
Member

@akaroml akaroml commented Sep 22, 2017

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

@akaroml akaroml added the external label Sep 22, 2017
@akaroml akaroml added this to the 0.2.0 milestone Sep 22, 2017
@akaroml
Copy link
Member

@akaroml akaroml commented Oct 26, 2017

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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.