microsoft / microsoft/vscode-java-debug

Failed to get sources when debugging multi module maven project in vscode

Open
#1,266 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

ai-triaged bug multimodule sourcemap
Dominant language
TypeScript
Stars
591
Forks
429
Avg merge
1d 9h
Merged PRs (30d)
19

Description

I managed to open a multi-module maven project in VS Code and set up the launch.json correctly. I can debug the project and the breakpoints are respected in the main module. When I set a breakpoint in a referenced module, the execution will break, but I see a decompiled version of the class with the following comments:

 // Failed to get sources. Instead, stub sources have been generated by the disassembler.
 // Implementation of methods is unavailable.

I added the plugin in pom.xml for that module to generate the source from maven and the source. Then I used mvn clean install and the source code JAR was generated successfully under the target folder for the specific module.

I tried to launch the debug again, and nothing worked. I still see the decompiled version of the class.

I configured "sourcePaths" in launch.json to point to the generated source JAR and it didn't and didn't work. I tried to point to the folder, relative path, absolute path, and with/without the filename, but nothing worked.

I appreciate your help to find a resolution to this issue.

Environment
  • Operating System: Windows 11
  • JDK version: 1.8 and 18
  • Visual Studio Code version: latest
  • Java extension version:
  • Java Debugger extension version:
Steps To Reproduce
  1. Open Java multi module maven project in VS code and wait until its fully loaded
  2. Setup the launch config to debug the project.
  3. Set breakpoints in the main and the other referenced modules.
  4. Start debug

[attach a sample project reproducing the error]
attach logs

Current Result

Breakpoint works only with the main module. The breakpoint in the other module works but source code is not used.

Expected Result

Breakpoint should work and source code should be displayed for all modules.

Additional Informations

I tried all possible steps to resolve this problem but nothing worked.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the multi-module setup using the referenced pom.xml and launch.json, with breakpoints in the main and referenced modules. Investigate how sourcePaths resolves the generated source JAR under target, then verify that breakpoints in all modules display source rather than decompiled classes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.