vscode-java-debug
vscode-java-debug copied to clipboard
Cannot evaluate expressions in referenced java files while debugging multi-module java projects in vscode
Hello, I've set up a multi-module project with a directory structure as below :
Demo Project (Non-Maven) ---- Demo1 (Maven) // RestAPI project with "GET" and "POST" requests ---- Demo2 (Maven) // RestAPI project with "GET" and "POST" requests ... and so on
I have built a jar for the Demo project and installed it as a dependency in Demo1 and also in other maven projects.
This jar refers to Util, Database connection, and several helper classes in Demo1.
I have installed the Community Server Connector extension to add servers for deployment.
I am using Tomcat 9 to deploy Demo1 on localhost and I'm trying to debug on vscode by firing "GET" requests through postman. For example, I have a file GetData.java in Demo1which contains definitions for different "GET" requests like "getdates", "getlivedata" and so on...
I can confirm that when I add a breakpoint in "GetData.java", it hits when I run localhost on Tomcat and I can evaluate variable values in the debug console as well as in the left navigation pane. But when the debugging flow moves to one of the java files from the dependency jar for Demo - for example, DemoUtils.java, then the expression evaluation throws an error "java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json ".
How do I add the project name as I am debugging a multi-module project which contains files from different projects? Is there any workaround for this by adding any specific launch configuration in launch.json? Also, does Tomcat 9 refer to the launch.json in vscode?
Any help regarding this issue would be appreciated. Thanks!
Environment
- Operating System: MacOS Catalina
- JDK version: 1.8
- Visual Studio Code version: Version: 1.68.1 (Universal)
- Java extension version: Extension Pack For Java (0.24.0)
- Java Debugger extension version: Debugger For Java (0.42.0 - 2022-06-29)
- Community Server Connector : redhat.vscode-community-server-connector
- Tomcat 9.0.64