Remote debugging and Maven dependencies

Hi all,

I've got a problem. The problem is that when I (remote) debug my code, my dependencies are messed up, even though IntelliJ finds them when programming. This has the effect that while debugging, my debugger jumps to some (random?) class file with the same name, which is a dependency of some other project/module, but has a wrong version!

for example, this is my project:

module1
- submodule1.1
- submodule1.1
  dependency on XYZ class version 2.1-SNAPSHOT (points to 'workspace')
module2
- submodule2.1
- submodule2.2
  dependency on XYZ class version 2.0 (points to maven repo)
module3 (containing XYZ class version 2.1-SNAPSHOT)

The problem is that when I debug module1, (for example submodule 1.1), I encounter a class XYZ, which is resolved incorrectly. The debugger in IntelliJ jumps to the 2.0 version in the maven repo, even though my project has a dependency on the 2.1-SNAPSHOT version. IntelliJ even jumps to the class when it's a dependency of a totally unrelated module, which is totally outside the scope of the current SUT (the class which I'm debugging). But during code completion and typing/navigation in the IDE, everything works okay: clicking on it points to the correct location. However, when (remote) debugging, and pressing F7, intellij goes the repo version, which is not correct!

Now I cannot debug my code anymore, which is annoying to say the least! How can I fix this???

Thanks, Erik

3 comments
Comment actions Permalink

I'm currently trying to solve the exact same problem myself.  My current "solution" is to try and use version dependency ranges defined in a <dependencyManagement> section of a parent pom which each sub module inherits from.  As IDEA sees only a single version declaration, when the project gets generated/setup things seem to resolve themselves fairly nicely (at least so far).

0
Comment actions Permalink

Hi, Erik,

I tried to reproduce the problem, but failed.
Please check you debug configuration is set up properly (module's classpath set to the corresponding module and dependencies are all arranged)

If you are sure it is configured correctly, please create a sample project with debug configuration set up.

Thanks,
Anton Makeev

0
Comment actions Permalink

Hi Anton,

I am also facing the similar problem where Idea is picking up a class from a dependency of a different module. This is happening when I am trying to perform remote debugging with Felix code. Here if I put a breakpoint in say FelixResolverState then opens up a different version of same class which is dependency of another module

Question - Is there any way to order the classpath used for debug configuration like its possible in Eclipse? How does Idea picks up a class to show while debugging if multiple version exist?

I am using 9.0.4

With this issue it becomes very difficult to debug

0

Please sign in to leave a comment.