Changes in code are not recognised when debugging a multi-module
I have two modules which I put in the same project: Module 1 (Maven) has a dependency on module 2 (Gradle). The main class is in module 1 and it is uses classes from module 2.
As both are in the same project I can move without any problems from classes of module 1 to classes of module 2 and back. I can also set breakpoints in classes of module 2 and debug the whole code. But whenever I change the code in module 2 (and restart the debugger), the changes are not recognized and the debugger "skips" the new lines. I have tried to set the source in the module dependencies ("Project Structure"), rebuild the project, refresh dependencies - but nothing helps. The only why to make the debugger respect the changes in the code is to build module 2 and publish the jar to the local maven repo.
This is very annoying and time consuming. I have done this many times before with multiple maven modules (and older intellij versions). Is this a gradle problem? Is there any solution?
I am using intellij ultimate 2020.1
请先登录再写评论。
Hi. Could you please provide a demo project to reproduce a problem?
I have created a demo project. You can clone it from here: https://gerido@bitbucket.org/gerido/demo.git
Steps to reproduce:
Expected: the debugger steps through the changed code
Actually: the debugger ignores the changed code
We've had several engineers (4-7) run into same issue after upgrading to IntelliJ Ultimate 2020. Only fix was to uninstall IntelliJ Ultimate 2020, and revert back to 2019.
Thanks, but I don't think that downgrading to 2019 is a fix. Debugging is a core functionality of an IDE and it should work also in the new version.
I agree 100%, Ido. Sorry, I wasn't clear -- my info was intended for JetBrains Support. Unfortunately my comment was no help for you though.
I know - my comment was also intended for JetBrains Support - they have a big problem with multi-module and gradle. I actually did downgraded to 2019 - it is impossible to work with 2020 if you use multi-module projects (which I do a lot). So thanks anyway for your comment and I really hope that JetBrains Support will answer soon.
Ido,
Unfortunately this scenario (mixed maven/gradle projects) is not supported at the moment, I have filed a task for it, please watch/vote here: https://youtrack.jetbrains.com/issue/IDEA-249639
PeteH,
Your case looks different. Please describe, what was working for you before the upgrade, and what is missing now?
Hi Nikita and thanks for answering.
First of all, the problem seems to be generally with gradle. I have changed the demo project so that both modules are now gradle modules, but the issue is still there. You can pull from the demo-repository and repeat the steps to reproduce from my earlier comment.
Before I mainly worked with maven, and multi-module project always worked for me without any issues. I am only working with gradle since a few month, and multi-module is very very annoying. I suspect that this issue is also existing in previous intellij versions - I downgraded to 2019.3.4, as recommended by PeteH, but this didn't help much.
Ido, for a pure-Gradle environment as a workaround, try using Gradle Composite build https://docs.gradle.org/current/userguide/composite_builds.html
You will have to link just one (composite) builds
Thanks Nikita, we will give it a try. In the meantime, in order to be able to work properly, we already combined some of our (separate) modules into a gradle multi-module. It would be very nice, though, if the multi-module functionality in intellij will work identically for maven and for gradle.