microsoft / microsoft/vscode-java-debug

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

未关闭
#1,266 4 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

ai-triaged bug multimodule sourcemap
主要语言
TypeScript
星标
591
派生
429
平均合并
1 天 9 小时
30 天内合并 PR
19

描述

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先使用所引用的 pom.xml 和 launch.json 重现多模块设置,并在主模块和所引用的模块中设置断点。调查 sourcePaths 如何解析 target 下生成的 source JAR,然后验证所有模块中的断点显示的是源代码,而不是反编译的类。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, vscode
领域
developer-experience, devtools
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。