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

前端 未结 3 832
情深已故
情深已故 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:24

    1) Build project B to your localRepository with source files.

    • If B is a maven project, you can use the source plugin. Then mvn install should generate file B-version-sources.jar.
    • If B is a gradle project, you can define a task to generate the sources.

    2) Open project A on IntelliJ. Project A has a dependency to B, so IntelliJ can see B-version-sources.jar. You just need to open the class on B that you want to debug and set the breakpoints. On the IntelliJ editor you will see a little lock symbol that indicates the class is read-only.

    (Depending on your IntelliJ version, you may not even need to have the "-sources" in your local repository in step (1) above, because IntelliJ may be able to decompile the classes to the editor and allow you to set breakpoints.)

提交回复
热议问题