Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 786
Robert Christian Avatar asked May 17 '13 20:05

Robert Christian


People also ask

How do I debug in Gradle?

To do that, just pick the Gradle Remote Debug configuration and then click the Debug icon on the project to be debugged. For more info, you can read the Gradle documentation. Follow us for more productivity tools & ideas for Android, Kotlin & Gradle projects.

How do I run debug mode in IntelliJ?

Run the program in debug modeClick the Run icon in the gutter, then select Modify Run Configuration. Enter arguments in the Program arguments field. Click the Run button near the main method. From the menu, select Debug.

How do I view Gradle tasks in IntelliJ?

Click Gradle on the right sidebar to open the tool window. The tool window displays the Gradle linked projects, their tasks, dependencies, and all changes made to the underlying build.


1 Answers

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.

like image 197
Errol Pais Avatar answered Sep 28 '22 17:09

Errol Pais