microsoft / microsoft/vscode-java-debug
Failed to get sources when debugging multi module maven project in vscode
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 591
- Fork
- 429
- Merge medio
- 1g 9h
- PR unite (30g)
- 19
Descrizione
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
- Open Java multi module maven project in VS code and wait until its fully loaded
- Setup the launch config to debug the project.
- Set breakpoints in the main and the other referenced modules.
- 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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo la configurazione multi-modulo utilizzando i pom.xml e launch.json referenziati, con breakpoint nel modulo principale e nei moduli referenziati. Analizza come sourcePaths risolve il source JAR generato sotto target, quindi verifica che i breakpoint in tutti i moduli mostrino il codice sorgente anziché classi decompilate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java, vscode
- Ambito
- developer-experience, devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100