You can debug grails applications outside of an IDE with the bare bones jdb
debugger that comes with the JDK. You won't get the typical IDE debugging experience, but something more like a traditional command-line debugger like gdb
on Unix.
To get started, run your application with grails -debug
instead of grails
. You'll see
Listening for transport dt_socket at address: 5005
At this point, run jdb
as follows:
jdb -attach localhost:5005
You should be prompted with a prompt like main[1]
. Now you can set breakpoints and watches and start your app. For example:
main[1] stop in mypackage.MyController.action()
Deferring breakpoint mypackage.MyController.action().
It will be set after the class is loaded.
main[1] run
When the breakpoint is hit, you can step through the code with step
and next
, and continue running with cont
.