intellij调试Grails2.3+

来源:互联网 发布:ie11 js缓存清除不掉 编辑:程序博客网 时间:2024/06/08 01:32

初学Grails,上手版本为2.3.4,开发工具intellijidea12.1.6,调试时死活不进断点,苦思其解,良久不破。

参考How to debug with IntelliJ IDEA + Grails 2.3.x,豁然开朗,翻身上马,迅速测试,得异常:Unable to open debugger port : java.net.ConnectException "Connection refused: connect

愤然google之,悻然得解:Not able to debug webservice code in IntelliJ。

按图索骥,测试良久,终于成功,尚觉《How to debug with IntelliJ IDEA + Grails 2.3.x》大作细节不足,《Not able to debug webservice code in IntelliJ》无头无尾,特此作几点补充:

1:创建一个新remote后,在configuration中的settings中选择项目,端口默认为5005,配置完成后如下:


2:注意上图中“Command line argurment for running remote JVM”,需要将其下的参数配置信息复制到Grails配置的VM options中,配置完成后如下所示:


3:此时在主界面中点击"Debug"按钮开启debug模式,可能还会出现异常Unable to open debugger port : java.net.ConnectException "Connection refused: connect"(不管你出没出现,反正我是出现了),此时先在IDEA的toolbar中选择当前的Grails项目,用debug模式开启,console出现如下信息:

再在toolbar中选择刚刚配置的remote项目,点击debug启动,此时在remote项目的console中就能够看到“Connected to the target VM, address: 'localhost:5005', transport: 'socket'”了,表示启动成功,加上断点,可见进入了断点:




摸索许多,终知其可,至于为什么,得再学习。



转眼就过了一年,今天发现在idea14上直接在buildconfig.groovy中将run设置为false即可调试,原来这么简单!


0 0
原创粉丝点击