DonJayamanne / javaVSCode

Extension for java development on VSCode (deprecated)
https://marketplace.visualstudio.com/items?itemName=donjayamanne.javaDebugger
MIT License
43 stars 29 forks source link

Buggy debugging for Spring Boot applications caused by the new released version (0.1.4) #79

Closed khe817 closed 7 years ago

khe817 commented 7 years ago

New released version of the debugger (0.1.4) broke something related to debugging multi-threaded processes.

Now to run the remote debugger for Spring Boot applications, I have to follow some extra steps:

My launch.json configurations are still the same as the one in issue #13 :

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Java Remote",
            "jdkPath": "${env.JAVA_HOME}/bin",
            "type": "java",
            "request": "attach",
            "stopOnEntry": true,
            "cwd": "${workspaceRoot}/src/main/java",
            "startupClass": "${relativeFile}",
            "sourcePath": ["${workspaceRoot}/src/main/java"],
            "classpath": ["${workspaceRoot}/target/classes"],
            "remoteHost": "localhost",
            "remotePort": 5005
        }
    ]
}

Pros is now I can attach and detach the debugger multiple times after the application starts up for debugging. I.e. I could edit the code, then run the debugger again without having to restart Spring Boot. Which is nice!

khe817 commented 7 years ago

I have figured it out. There is nothing wrong with the debugger. There is a new launch configuration startupClassPathPattern that I should use to make it debug normally.

My new launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Java Remote",
            "jdkPath": "${env.JAVA_HOME}/bin",
            "type": "java",
            "request": "attach",
            "stopOnEntry": true,
            "cwd": "${workspaceRoot}",
            "startupClass": "${relativeFile}",
            "startupClassPathPattern": "src/main/java/",
            "sourcePath": ["${workspaceRoot}/src/main/java"],
            "classpath": ["${workspaceRoot}/target/classes"],
            "remoteHost": "localhost",
            "remotePort": 5005
        }
    ]
}
faustinoaq commented 7 years ago

@khe817 Your issues are very helpful, Thanks you for contribute! 👍