2

由于 Grails 2.3.x 新的分叉执行,IDEA(现在是 13.1 版)只能远程调试它。但 GGTS 3.5/M2 甚至可以在分叉执行中直接调试它。IDEA 可以像 GGTS 3.5 一样做同样的事情吗?

或者我可以完全禁用分叉执行并让 grails 2.3.x 像 grails 2.2.x 一样与 IDEA 一起工作吗?我试过这个: IntelliJ IDEA Debugger is not working on a Grails Project 但是当我通过在 grails-app/conf/BuildConfig.groovy 中设置禁用分叉执行时:

grails.project.fork = [
    test: false,
    run: false
]

并在IDEA中进行调试,只有不更改任何代码才能调试,否则重载功能会崩溃(控制台输出可重载类型的子类型不可重载...blablabla)并且断点将不再停止。

由于这不是一个包含大量测试的大型项目,所以我在 fork 模式中遇到了麻烦。我不能再使用 ctrl+c 关闭控制台(有时,stop-app 不起作用,我必须在任务管理器中杀死 java 进程),我不能直接在 IDEA 中调试,谁能给我一个解决方案为了这?

4

2 回答 2

0

利用

grails run-app --debug-fork

这将以调试模式启动分叉。然后在 IntelliJ 中转到运行/编辑配置并使用默认设置添加一个新的“远程”配置(随意调用它)。

然后每次你想调试时,只需使用这个新配置附加远程调试器(你只需要创建一次)

于 2014-03-20T07:34:45.260 回答
0

是的,您可以通过删除或注释掉自动放入 BuildConfig 的配置部分来避免在分叉模式下运行。请注意,如果您更改 Groovy 版本,则需要分叉编译,并且您必须使用远程调试器选项。

//Removing fork
//grails.project.fork = [
//    // configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required
//    //  compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
//
//    // configure settings for the test-app JVM, uses the daemon by default
//    test: [maxMemory: 768, minMemory: 64, debug: true, maxPerm: 256, daemon:true],
//    // configure settings for the run-app JVM
//    run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
//    // configure settings for the run-war JVM
//    war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
//    // configure settings for the Console UI JVM
//    console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
//]

编辑:对不起,这只适用于 IDEA 13.0.x 并在 13.1 中中断

于 2014-03-20T20:48:11.597 回答