microsoft / microsoft/vscode-java-debug

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

Ouverte
#1,266 4 commentaires 1 réaction 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

ai-triaged bug multimodule sourcemap
Langage dominant
TypeScript
Étoiles
591
Forks
429
Merge moyen
1 j 9 h
PR mergées (30 j)
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.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par reproduire la configuration multi-module à l’aide des pom.xml et launch.json référencés, avec des breakpoints dans le module principal et les modules référencés. Examinez comment sourcePaths résout le source JAR généré sous target, puis vérifiez que les breakpoints de tous les modules affichent le code source plutôt que des classes décompilées.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java, vscode
Domaine
developer-experience, devtools
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.