Skip to content

Instantly share code, notes, and snippets.

@CaptainOfFlyingDutchman
Created January 22, 2016 15:36
Show Gist options
  • Save CaptainOfFlyingDutchman/524cf73acedb0d3d66cf to your computer and use it in GitHub Desktop.
Save CaptainOfFlyingDutchman/524cf73acedb0d3d66cf to your computer and use it in GitHub Desktop.
Debugging your Grails 3.0.x application

Every new version of Grails brings some enhancements, and challenges on developer side too. Starting Grails 2.3.x we used different approach to debug our application, and now we are again on same place with Grails 3.0.x.

As Grails is now using Spring Boot and Gradle, we have to hook into bootRun gradle task that gets added by Spring Boot Gradle plugin. You won't find this task anywhere in your build.gradle file but inside Gradle tool window of IntelliJ IDEA. To facilitate debugging again we just need to hook into this bootRun task as follows:

bootRun {
    addResources = false
    jvmArgs = ["-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"]
}

Now follow along as follows:

  1. In IntelliJ IDEA add a remote configuration by going to Run->Edit Configurations...
  2. Go to terminal, execute grails run-app and wait for prompt that says Listening for transport dt_socket at address: 5005.
  3. Now just hit debug symbol beside your remote configuration on IntelliJ IDEA toolbar. You're again debugging your Grails application!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment