Compiled java classes are shown when debugging in Gradle multi module project

Hi,

We have converted almost all of our multi module project from using Ant and Ivy to using Gradle, and therefor we use the Gradle plugin in Intellij. The plugin works fine, but we are seeing problems when debugging our application.

We start a remote debugging session against our Tomcat server and place some breakpoints in our code. Once the breakpoints are reached a decompiled version of the class with the breakpoint is shown, not the actual source. We have to manually add the sources, which is somewhat annoying. This was not a problem before we switched to Gradle and the Gradle plugin.

Can anyone shed some light on this issue?

Thanks,

 

//Magnus

4 comments
Comment actions Permalink

if you use gradle file dependencies (https://docs.gradle.org/current/userguide/dependency_management.html#sub:file_dependencies) you can convert it to external module dependencies (https://docs.gradle.org/current/userguide/dependency_management.html#sub:module_dependencies) using local ivy(or maven) repo with bin and sources artifacts

e.g.

repositories {
  ivy {
    url "$rootDir/repo"
layout('pattern') {
            ivy '[organisation]/[module]/[revision]/[module]-[revision]-ivy.[ext]'
            artifact '[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]'
            m2compatible = true
    }
  }
}

0
Comment actions Permalink

We don't use file dependencies, that's a big no-no! We only depend on projects.

I

0
Comment actions Permalink

Hello! Were you able to solve this in any way? I have the exact same problem. I would like for Idea to show me the debugging within the modules' code not using .class files.

0
Comment actions Permalink

Hi,

It's been about a year since I left the assignment where this was a problem, but I recall it had something to do with classes that didn't get identical names when compiled. For example Names.java should become Names.class. However, if you add multiple classes to the same Java file, then you will get filenames that doesn't match, and that seemed to be the problem at the time I wrote the original question.

The project I worked on had a lot of inner classes, anonymous classes, java files with multiple class definitions etc.

 

Hope that helps :)

0

Please sign in to leave a comment.