grails / grails-database-migration

Grails® framework Database Migration Plugin
Apache License 2.0
98 stars 115 forks source link

dbm-gorm-diff fails on multiproject build #282

Open snimavat opened 2 years ago

snimavat commented 2 years ago

In a multiproject build - dbm-gorm-diff - fails

grails {
    plugins {
        implementation project(':my-plugin')
    }
}

When dbm-gorm-diff is run in application Grails tries to run dbm-gorm in plugin also, and fails

> Task :my-plugin:dbmGormDiff FAILED

Will fail to generate diff

davebrown1975 commented 1 year ago

You can configure the dbm* tasks in build.gradle to skip execution in your other modules:

// To prevent database migration tasks running against each plugin and run against the main app only
gradle.taskGraph.whenReady {graph ->
    graph.getAllTasks().each {Task task ->
        // Database migration plugin ignore these tasks, else it will fail
        def isPluginDbm = (task.path =~ /:+.+:+dbm/)        
        if (isPluginDbm) {
            task.enabled = false
        }
    }
}