How to debug a project in Intellij while setting the breakpoints in another project

前端 未结 3 848
情深已故
情深已故 2021-01-05 19:49

I have a (Maven-based) project A loaded in Intellij that has a number of dependencies.

I have the source files of one of those dependencies (say B) in another Intell

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-05 20:36

    The other answers sound like they would work, but all I had to do was go to:

    Project Structure (Alt+Shift+S)

    > Modules

    > on the Sources tab for the module that has dependencies, look on the right side,

    click the + Add Content Root, then add the src folder of the dependency project.

    I was able to then put breakpoints in those src files and IntelliJ would step to them in debugging.

    (Note you may see the warning "Alternative source available for the class ...")


    Reference

    From https://www.jetbrains.com/help/idea/creating-and-managing-modules.html,

    "Modules normally have one content root. You can add more content roots. For example, this might be useful if pieces of your code are stored in different locations on your computer."

提交回复
热议问题