debugging a Grails app from IntelliJ -


i've been struggling debug grails 2.5.0 app inside intellij. specifically, i'm finding difficult configure app such

  1. functional tests can debugged
  2. functional tests can run
  3. the app can debugged
  4. the app can run

when (1) , (2) launched inside intellij (version 14.1.4).

here's toy grails app i'm using investigate issue, has single functional test. key getting debugging working seems these jvm forking settings buildconfig.groovy.

grails.project.fork = [         // configure settings compilation jvm, note if alter groovy version forked compilation required         //  compile: [maxmemory: 256, minmemory: 64, debug: false, maxperm: 256, daemon:true],          // configure settings test-app jvm, uses daemon default         test   : [maxmemory: 768, minmemory: 64, debug: false, maxperm: 256, daemon: true, jvmargs: jvmargs],         // configure settings run-app jvm         run    : [maxmemory: 768, minmemory: 64, debug: false, maxperm: 256, forkreserve: false, jvmargs: jvmargs],         // configure settings run-war jvm         war    : [maxmemory: 768, minmemory: 64, debug: false, maxperm: 256, forkreserve: false],         // configure settings console ui jvm         console: [maxmemory: 768, minmemory: 64, debug: false, maxperm: 256] ]  // include line below debug functional tests intellij. tests should launched in debug mode intellij //grails.project.fork = null 

debug run-app (3)

with forking enabled, app can debugged running inside intellij, launching remote debugger ide connect app on port 5005. jvm forking settings ensures app runs remote debugging enabled, sure launch app running it, rather debugging it.

debug functional tests (1)

to debug functional tests, need include this line

grails.project.fork = null 

such forking (and remote debugging disabled. can debug functional tests launching test via intellij debug configuration.

it's tedious have include/comment out line depending on whether it's app or functional test that's being debugged, i'm looking simpler solution.

one might think avoided with

if (environment.current == environment.test) {     grails.project.fork = null } 

but unknown reason, not work.

i have following settings in buildconfig.groovy:

grails.project.fork = [      // configure settings test-app jvm, uses daemon default     test: false, // see http://youtrack.jetbrains.com/issue/idea-115097     // configure settings run-app jvm     run: [maxmemory: 768, minmemory: 64, debug: false, maxperm: 256, forkreserve:false],     // configure settings run-war jvm     war: false,     // configure settings console ui jvm     console: false ] 

you need add 2 run configurations in intellij:

  • add new run configuration grails project. use run-app --debug-fork command line.
  • add new remote debug configuration. use default settings.

to debug app, run first configuration. grails app start , should print listening transport dt_socket @ address: 5005. once see message, run debug configuration...

let me know if need screenshots


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -