Skip to content

When the debugger stops at a breakpoint, it loads the source in target/classes, not src/java #823

Closed

Description

@phudson

(I thought I'd raised this already, not sure where it went)

This is more of a question or feature request than an issue

I'm making some changes to a Maven project (which I didn't write originally) in VS Code. As part of this, I need the debugger, since I make mistakes.

The build process seems to involve creating a copy of each source file in the target/classes folder. That's OK, except...

When stopping at a breakpoint, VSCode tends to load this copy, and not the original source file. It is OK to work with the original as I can load that separately, set breakpoints from there, etc.

But intellisense and hovers don't work in the target/classes version, and if I make edits there they don't persist of course.

How do I configure the debugger not to look in target/classes to find source files?

Environment
  • Operating System: WIndows 10
  • JDK version: 1.8
  • Visual Studio Code version: 1.45.1
  • Java extension version: 0.9.1
  • Java Debugger extension version: 0.26.0
Steps To Reproduce

Not easy to do this, I cannot share the code

Current Result

When I stop at a breakpoint, VSCode displays the source file from target/classes, not the one in src/java

Expected Result

The file in src/java is used

Additional Informations

Activity

  1. testforstephen commented on Jun 3, 2020

    @testforstephen
    Contributor

    The source mapping is based on the your project's classpath, it's not configurable in the debugger extension. The project loading service is provided by vscode-java extension. Look like your project mixed the source with the target/classes.

    Could you please attach a sample project to help reproduce the problem? At least share your pom.xml file.

  2. greenwave01 commented on Jun 11, 2020

    @greenwave01

    Im having an issue changing the webroot and the sourceMapPathOverrides when i launch the debugger, I can break in the java code, but it doesn't recognize other breaks. I've tried adding an attach to process in a launch.json in the vscode-java extension, am I on the right path?

  3. phudson commented on Jun 11, 2020

    @phudson
    Author

    The source mapping is based on the your project's classpath, it's not configurable in the debugger extension. The project loading service is provided by vscode-java extension. Look like your project mixed the source with the target/classes.

    Thanks for the reply

    Could you please attach a sample project to help reproduce the problem? At least share your pom.xml file.

    It turns out this was a red herring. It was a bug in the POM left by the original author. The Java files were listed as resources, and so copied.

    Sorry about this spurious ticket!

  4. phudson commented on Jun 11, 2020

    @phudson
    Author

    Im having an issue changing the webroot and the sourceMapPathOverrides when i launch the debugger,

    This is probably entirely unconnected with my issue. I suggest you raise a separate issue about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions