Gradle: Debug multiple JVMs running in parallel

Answered

Hi!

If I understand correctly automatic debugging of Gradle JavaExec tasks works by IntelliJ starting a JDWP server in the background and automatically adding the port of the debug server to the jvmArgs of the task, right?

What I have now is a project consisting of multiple applications in the form of a single Gradle project consisting of subprojects.

At first we tried using a Compound Run Configuration which started different Gradle tasks. This works okay but problems are:

  1. Log output goes to different tabs
  2. Gradle doesn't like e.g. 4, 5 invocations of the same tasks at once. We often have some weird corruptions of e.g. compiled artifacts.

The next approach is to use Gradle --parallel flag and specify all the different tasks in the same Run Configuration. This works great! Log output is now shown in one window and as we only have one Gradle invocation the startup is pretty fast and no corruptions occur.

Now the problem is that debugging doesn't work in all projects.

I haven't dug into IntelliJ source code yet to figure out how it works but I assume that it doesn't start multiple JDWP servers, one for each JavaExec task? Am I mistaken? Is there some solution for this problem?

Thanks!

0
2 comments

Please try these options:

in Gradle run configuration.

If problem remains, please file a request at https://youtrack.jetbrains.com/issues/IDEA for such a support. Thank you.

0

Cool, it works when I only check the third option (Debug all tasks on the execution graph).

Thanks!

0

Please sign in to leave a comment.