How to debug grails command
Asked Answered
A

5

12

When I run dbm-generate-changelog exception is thrown. I would like to debug this script but I can't figure how to do it. I tried to put breakpoint to the script file _DatabaseMigrationCommon.groovy and then in eclipse created new "debug configuraion" command. When I run this none of breakpoints suspend the execution. I also tried with --debug argument.

setup:
Grails: 2.3.3
GGTS: 3.4
Eclipse: 4.3
Amontillado answered 24/11, 2013 at 21:7 Comment(0)
H
15

Do the following:

  1. launch grails with the -debug option

    grails -debug run-app
    
  2. create Remote Java Application debug configuration in Eclipse and set port to 5005

  3. enjoy breakpoints and step-by-step debugging

Handling answered 12/2, 2014 at 19:55 Comment(0)
S
3

Try to use dbm-generate-changelog -verbose -stacktrace, it could help you to find cause of fault.

Suisse answered 25/11, 2013 at 12:48 Comment(0)
V
3

I'm using GGTS tool. Open it. Go to "Debug As" (bug icon).
Select "grails" in the list and select "new configuration" (blank paper icon).
In the next window, select your grail project in the "project field".
Write "run-app" in the grails commmand field. click "Apply" and click "Debug".

That is.

Vacuity answered 10/4, 2016 at 14:51 Comment(0)
M
0

In Grails 4, you have to use the debug-jvm argument, i.e. grails run-app -debug-jvm

Source: https://docs.grails.org/4.0.10/ref/Command%20Line/run-app.html

Mindi answered 16/6, 2021 at 7:37 Comment(0)
D
0

This doesn't answer your question as to "how to debug it", but the dbmInit target had a bug in it.

The dbmInit target depends on bootsrap and loadApp, then manually calls configureApp. This bootstraps the system twice, and some beans (quartz scheduler and grails_cache) get mad if they get recreated with the same name.

changing the top few lines to

target(dbmInit: 'General initialization, also creates a Liquibase instance') {
    //  depends(classpath, checkVersion, configureProxy, enableExpandoMetaClass, compile, bootstrap, loadApp)
        depends(classpath, checkVersion, configureProxy, enableExpandoMetaClass, compile, bootstrapOnce)

    //  configureApp()
    
    try {....

basically replacing bootstrap, ladApp, and configureApp() with a call to bootstrapOnce might clean (well, 9 years ago, so have cleaned) things up for you.

Deconsecrate answered 15/7, 2022 at 22:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.