Groovy is a scripting language, so it is possible to run Groovy code without compiling to Java byte code. The necessary condition is that Groovy is installed on your machine. Then, running a Groovy script in a shell looks like the following line.
~>groovy TestScript.groovy
Now, something is wrong with the script, only on a special environment. So you want to debug your Groovy script from the shell. Fortunately, it works for Groovy just like for Java. You only have to export the Java options for debugging.
~>export JAVA_OPTS="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=y"
Now, we can debug our script running from the shell with our favorite IDE.
~>groovy TestScript.groovy Listening for transport dt_socket at address: 4000
Advertisements
Pingback: Semana Groovy 39 | Groovy & Grails Brasil
May 29, 2018 at 16:57
what to do from IDE ?
LikeLike
June 7, 2018 at 15:23
Hi Madhu,
do you mean how to configure your IDE to enable remote debugging?
Best regards,
Sandra
LikeLike