2

Because of Grails 2.3.x's new forked execution, IDEA(now version 13.1) can only debug it remotely. But GGTS 3.5/M2 can debug it directly even in forked execution. Can IDEA do the same thing just like GGTS 3.5?

Or can I fully disable forked execution and let grails 2.3.x just work with IDEA like grails 2.2.x? I've tried this: IntelliJ IDEA Debugger isn't working on a Grails Project but when I disabled forked execution by setting in grails-app/conf/BuildConfig.groovy:

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

and Debug it in IDEA, debug can only work if you don't change any code, otherwise the reloading function will crash(console output Subtype of reloadable type is not reloadable...blablabla) and the the breakpoint will not stop any more.

Since this is not a large project with numbers of tests, I get troubled in the fork mode. I can't close the console using ctrl+c anymore (sometimes, stop-app not works, and I have to kill the java process in task manager), and I can't debug directly in IDEA, could anyone give me a solution for this?

Community
  • 1
  • 1
Flashing
  • 21
  • 2

2 Answers2

0

Use

grails run-app --debug-fork

Which will start the fork in debug mode. Then in IntelliJ go to Run/Edit Configurations and add a new "Remote" configuration with the default settings (call it whatever you want).

Then each time you want to debug just attach the remote debugger using this new configuration (you only have to create it once)

Graeme Rocher
  • 7,985
  • 2
  • 26
  • 37
  • Yes I know it, you have to debug remotely. But this is not convenient, I want to find a way to debug it directly just like ggts 3.5. – Flashing Mar 20 '14 at 10:33
0

Yes, you can avoid running in the forked mode by removing or commenting out that portion of the config that is automatically placed into your BuildConfig. Note that if you alter the Groovy version, forked compilation is required and you'll have to go with the remote debugger option.

//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]
//]

Edit: Sorry, this only worked up to IDEA 13.0.x and breaks in 13.1

th3morg
  • 4,321
  • 1
  • 32
  • 45