Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug a Grails 3.x application

I am trying to debug a Grails 3.x application using grails run-app --debug-fork. But when the application starts it does not wait for the debugger to attach. Any solution on how to debug a Grails 3.x application?

like image 660
Marco Avatar asked Apr 23 '15 14:04

Marco


People also ask

How do I debug grails application?

Select "grails" in the list and select "new configuration" (blank paper icon). In the next window, select your grail project in the "project field". Write "run-app" in the grails commmand field. click "Apply" and click "Debug".

How to debug grails application in intellij?

For debugging the app itself, starting from Grails 3 we can go to grails-app/init then right click on the Application. groovy class and click Debug 'Application' .

How do I cancel my grails application?

1.2 If you want to stop your server (and app), you can, at the grails prompt, enter 'stop-app', which will stop the server and app.


2 Answers

In IntelliJ you can right click the Gradle task bootRun and select Debug.

like image 138
rlovtang Avatar answered Sep 18 '22 12:09

rlovtang


In IntelliJ IDEA 2016.1, I create two configurations. This allows me to make solid use of all the context menus, etc. that IntelliJ IDEA offers. Here's how:

  1. The first configuration is a "Run" configuration. Edit the default configuration and in the "Command Line" field, enter run-app --debug-jvm
  2. The second configuration is a "Remote" configuration. On the "Run/Debug" dialog, click the + symbol and select "Remote" from the list. Name it "Debug" and save.
  3. Select your "Run" config from the config dropdown at the top and then click the green arrow to run the app. Monitor the console output until you see the message Listening for transport dt_socket at address: 5005.
  4. Select the remote debug profile you created in step 2 and click the debug button. In a few moments the console output will say Grails application running at http://localhost:8080 in environment: development.

Success!

like image 39
jmorhardt Avatar answered Sep 21 '22 12:09

jmorhardt