Robert Christian
Robert Christian

Reputation: 18300

Debug gradle jettyRun in IntelliJ

I run Jetty from the command line with:

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

gradle jettyRun

and see:

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 defaults, changing only the port to 9999.

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

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

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

Then I make requests that should result in hitting breakpoints. But the breakpoints are never triggered.

What am I doing wrong?

Thanks.

Upvotes: 7

Views: 5713

Answers (2)

ErrolTheHamster
ErrolTheHamster

Reputation: 51

You could have the "org.gradle.jvmargs" variable set in your gradle.properties file. This causes the JVM to be forked which means you are no longer debugging the right process.

In this case, you could either not set the "org.gradle.jvmargs" or pass it the debug parameters eg.

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

Setting the debug parameters in org.gradle.jvmargs would configure the forked process for debugging.

Upvotes: 5

eduardohl
eduardohl

Reputation: 1206

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

Upvotes: 0

Related Questions