Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ steps through the wrong lines when debugging remote Java application

I tried to remote debug a maven plugin for liquibase project with Intellij. The problem is that IDEA is highlighting the wrong source code line and I can't figure why. The source code that I try to debug is untouched. I manualy build and installed the plugin in my local maven repository from the sources the I use in Intellij. My Intellij version is 11.1.3 and maven version is 3.0.4 running on Ubuntu 12.04.

For debugging the maven plugin I used mvnDebug comand. If someone have the slightest idea about what is wrong than please give me some advices. Also if you need some more information please ask. I'm not too used to remote debugging (in fact this is the second time I done this) so I might slipped some information that you need.

like image 763
Faur Ioan-Aurel Avatar asked Oct 10 '12 16:10

Faur Ioan-Aurel


2 Answers

For me, whenever IntelliJ is highlighting the wrong line, it was always because the version of the JAR/classes being used to run the application differs from my source files - i.e. different version of the sources were used to build the JAR and/or classes.

You are going to have to be sure that you are working from the exact source that was used to build the classes you are debugging.

You can verify this by looking at the classpath being used to launch the application, locating the JAR file or classes directory that contains the classes you are debugging, and verifying that they were built from the sources you are inspecting.

Note that when you are debugging third-party libraries, you often can download the "sources" jar (see IntelliJ2-IDEA get Maven-2 to download source and documentation).

like image 180
noahlz Avatar answered Sep 17 '22 15:09

noahlz


If you stumbled across this post, and sure that the source and JAR are the same code, then this could be your problem.

http://youtrack.jetbrains.com/issue/IDEA-8021

like image 45
Sky Kelsey Avatar answered Sep 18 '22 15:09

Sky Kelsey