【问题标题】:How to let IDEA directly debug grails 2.3.x application just like GGTS 3.5?如何让 IDEA 像 GGTS 3.5 一样直接调试 grails 2.3.x 应用程序?
【发布时间】:2014-04-26 15:58:44
【问题描述】:

由于 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 isn't working on a Grails Project 但是当我通过在 grails-app/conf/BuildConfig.groovy 中设置禁用分叉执行时:

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

并在IDEA中调试,调试只能在不修改任何代码的情况下进行,否则重载功能会崩溃(控制台输出可重载类型的Subtype is not reloadable...blablabla)并且断点不会停止没有了。

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

【问题讨论】:

    标签: debugging grails intellij-idea reloading


    【解决方案1】:

    使用

    grails run-app --debug-fork
    

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

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

    【讨论】:

    • 是的,我知道,您必须远程调试。但是这样不方便,想找个方法直接调试,就像ggts 3.5一样。
    【解决方案2】:

    是的,您可以通过删除或注释掉自动放入 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 中中断

    【讨论】:

    • 这个我试过了,和 set grails.project.fork=false 一样。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-07-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-05
    • 2013-05-24
    • 1970-01-01
    • 2016-04-02
    相关资源
    最近更新 更多