Debugging gradle jettyRun in IntelliJ

I run Jetty from the command line using

export GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=n" gradle jettyRun 

and look:

 Listening for transport dt_socket at address: 9999 

... then in IntelliJ Idea (Ultimate 12.1.3) I create a new remote debug configuration with all the default values, changing only the port to 9999.

When I run (debug) using the remote configuration, I see:

 Connected to the target VM, address: 'localhost:9999', transport: 'socket' 

... which makes me think that everything is working as expected.

Then I make queries that should result in breakpoint hits. But breakpoints never fire.

What am I doing wrong?

Thanks.

+6
source share
2 answers

You may have the variable "org.gradle.jvmargs" set in the gradle.properties file. This causes the JVM to fork, which means that you no longer debug the correct process.

In this case, you cannot set "org.gradle.jvmargs" or pass debugging parameters to it, for example.

org.gradle.jvmargs = -XX: MaxPermSize = 128m -Xdebug -Xrunjdwp: transport = dt_socket, server = y, suspend = y, address = 1233

Setting debugging options in org.gradle.jvmargs allows you to configure a forked process for debugging.

+5
source

In IntelliJ (at least 12.1.5), you can just go to JetGradle, right-click on jettyRun and then click on "Debug".

0
source

Source: https://habr.com/ru/post/945294/


All Articles