Search code examples
grailsgradledatabase-migrationsystem-properties

How to pass system properties to Grails 3 database migration commands


I am trying to pass system property to dbm commands - e.g.:

grails -Ddb.host=localhost dbm-gorm-diff

But system properties are ignored.

I have tried to add the following to build.gradle:

[bootRun, test, dbmUpdate, dbmGormDiff, runCommand].each { task ->
    configure(task) {
        systemProperties = System.properties
    }
}

It works for run-app but not for dbm commands.


Solution

  • Adding run-command seems to work:

    grails -Ddb.host=localhost run-command dbm-gorm-diff