How to step into source code of external jar that is defined in module settings?

I'm not able to step into the source code contained in an external jar even though I have defined this jar and its source files in the Module dependencies.  I must be missing something. I am running a Junit task and whenever I run this task within the IDE, I cannot step into these source files and setting a breakpoint in them shows an X rather than a v in the red circle of the breakpoint (and with a warning that no executable code was found at that line).

I have defined this external jar so that it appears in the Project structure, and I can open it and it shows the source files I am trying to step into.  I can double click these classes and the source file comes up.  But when running the Junit debug task, I cannot step into that source code.

Hopefully, there is a simple solution, but I have tried defining the external jar in various locations - in the classpath or not (when the debug task is running).  Any help would be appreciated.

Thanks,

- Steve Rowe

2 comments
Comment actions Permalink

Please make sure of several thing before atempting to debug jars:
- the most important thing: the source code is the source code used to produce the jar (exactly the same version as the jar). For example, you can easily attach source code for junit 3.7 to junit-3.8.jar, but you will get into troubles when trying to debug. The fact that IntelliJ told you that no executable code was found at that line makes me believe you have a version mismatch problem
- less important, but helpfull: make sure you have a jar which was compiled with debug information. (debug=true in ant). If not, you won't be able to inspect things as the values of local variables in the jar's source code.

0
Comment actions Permalink

Alexander,

Thanks - that got me looking into how the external file was built and found out it was not being compiled with the debug flag.  Boy, do I feel stupid!  The build system is a bit complex and uses custom properties that are turned off by default, so when I changed to a different branch of the source tree, my custom settings were missing.

Thanks again.

0

Please sign in to leave a comment.