debugger uses the maven artifacts for step in rather than the source codes?

Hello everyone.

I am using IDEA community edition version 139.872.1 for java development and have an annoying problem which might be due to some bad configuration, etc.  The project is JAVA and build system is maven with many modules and sub-modules, etc.

Problem is with the debugger and actions like go to classes (this happen sometimes) which open a compiled class from the maven artifacts rather than opening the actual source code which is present in the project itself. Same goes for debugger; if I set a  breakpoint in class ABC source file (this is remote debugging) the debugger will open the class from the Maven artifact (and shows the attach/download source option on top right) instead of opening the actual source file which is present in the project.

Anyone with similar issue?

Thanks.

4 comments
Comment actions Permalink

It definitely sounds like a configuration issue. I work with a 50+ maven module project daily with multiple web services and some application components. The debugger always breaks in the IDE source code; even when using a remote debugger.

Do all your maven modules ultimately have a common parent POM? If not, IDEA may not see them as a single project entity. Also, did you create the project or did you just import the primary maven POM?  You may want to try creating a fresh project just by importing the  primary maven POM and let IDEA configure everything.

0
Comment actions Permalink

A couple of questions to undestand the case.

1. When the issue occurs, the involved classes are from different Maven projects (IDEA modules), or from the same? E.g. the main class and a class whose method is called.

2. Compiled class you refer: does it from target directory (under a project root) or from local repository?

Regards,
Alexander.

0
Comment actions Permalink

If I understood the question correctly:

1- There is top module which has several sub modules in the project view. So, there is a top level project which has several child level projects and modules. For example one module named connections has three sub modules named db-connection, file-connection, and lib-connection (they are referenced from the connections' module's pom file as modules).

2- The debugger instead of opening the source file in the sub project (all visible when I expand different nodes in the project view) open the class files from the JAR files present in the maven respository. Hovering the mouse on the editor tab shows the full path to maven respository location.

An additional note: I switch between several branches quite frequently and whenever I do a switch it removes and add some maven modules automatically as different branches may have more or less modules.

Re: I cannot remove this project and create another one. Have lots of customizations on file coloring, etc. that I dont want to lose again.

Thank you.

0
Comment actions Permalink

sarahk wrote:

Re: I cannot remove this project and create another one. Have lots of customizations on file coloring, etc. that I dont want to lose again.

You may want to try creating a new project via a maven import just to see if that resolves the issue. If it doesn't solve the issue, all you've lost is 5 to 15 minutes. If it does solve the issue, you can copy most project specific settings from the {projectRoot}/.idea directory of the old project, so you will not lose anything. In the old project, before you do the copy, mark all your run/debug configurations as "shared" so they appear in the .idea/runConfigurations directory rather than the .idea/workspace.xml file. You would not want to replace any of the .iml module files (in the module directories) and the .idea/modules.xml file. Initially, you may want to not copy over the .idea/workspace.xml file.

Again, at the very least, this is a troubleshooting technique. It can at least helo track down the issue. I've seen a number of cases where people have issues like this and the usual cause is that they "manually" configured part of or all of the project rather than using the maven project import action.


One other question... in your POM, when Module A needs to use Module B, does your POM use the full artifact coordinates, or does it use:

<dependency>
    <groupId>${project.groupId}</groupId>
    <artifactId>project-module-B</artifactId>
    <version>${project.version}</version>
</dependency>


I'm not sure if that makes a difference. We've always used the ${project...} properties and all works OK. I could potentially see using the full artifact coordinates causing IDEA to see it as an external dependency. I'm not sure how the import process is implemented. Alexander can tell me if I'm way off base on that one :)

Alexander from JetBrains may have some other suggestions.

0

Please sign in to leave a comment.