Problem getting source code to match binaries


I'm having a problems when I attach to a remote system. I'm having a hard time getting Intellij to match up my local sources, with the jars on the remote machine. All my breakpoints seem to work, but when I hit them, I get a funny icon next to them claiming it can't match the source. Then when I step, the step returns in the view of the .class file, instead of my .java file.

My project is a little complicated, in that it is an imported maven project, that has many modules. It seems like Intellij is able to match the source to some of the modules, but not all of them.

What lookup order does IntelliJ use to find sources for remote debugging? I couldn't find any way to associate the remote session with one of my modules, so my guess is that in it's source lookup, it comes across the class in a jar, before it comes across it in the source path for my module. Does this sound plausible? Is there a way to work around it? Is there some option I'm missed?


Comment actions Permalink

The following works for me:
When the editor window has focus (cursor blinking within the class-file) , press ALT-F1 and select project view. This will expand the project tree and select the classfile within the jarfile within one of your modules. Now go to the found modules dependencies settings and check that sources are attached to that jar. (Selecting the library containing the jar in the project view and pressing F4 will get you there fast)

If that seems to be ok, check on the modules Sources tab that none of the mounted directories are red
This occurs frequently when importing from pom. The idea pom importer will create source folder entries to dirs like src/main/resource even when it doesn't exist

To test you new "settings" do:
1) close the class file that the debugger opened,
2) press CTRL-N to "navigate to class" and type the class name

If you get to the source code, the debugger usually also does so.

Comment actions Permalink

Hello, I had the same problem.

In my case, I had several projects which have a dependency with a common module. This common module was the one I could´nt debug correctly due to this issue.

I had to rebuild all the dependant modules after building the common module to solve the problem.

I wish it helps.





Please sign in to leave a comment.