Thursday, February 4, 2016

How to remote debug a gradle run

I'm using a spring boot application that is run by gradle via "gradle bootRun". The following are two ways to remote debug the java application:

  1. "gradle bootRun --debug-jvm" is a shortcut to remote debug by adding the following to the JVM parameters "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" 
  2. The application plugin applicationDefaultJvmArgs property can be added to build.gradle. I don't like to suspend the application, so note suspend=n.

    apply plugin: 'application' applicationDefaultJvmArgs = [ "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" ]

    You don't need to add any configuration in <HOME>/.gradle/gradle.properties to have this work for either solution.
Helpful documentation:

No comments:

Post a Comment

I appreciate your time in leaving a comment!