Grails 3 Database Initialization Error

I recently added a plugin for database migration in grails 3.0.11 application. The problem is that when I try to run the application, I get the following error:

ERROR grails.boot.GrailsApp - Application startup failed
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'springLiquibase_dataSource': 
Invocation of init method failed; nested exception is liquibase.exception.ChangeLogParseException: 
java.lang.IllegalArgumentException: Script text to compile cannot be null!

It looks like he cannot find the changelog.xml file in my grails-app / migrations folder. My build.gradle file contains:

buildscript {
    dependencies {
        classpath "org.grails.plugins:database-migration:2.0.0.RC1"
    }
}

and

sourceSets {
    main {
        resources {
            srcDir 'grails-app/migrations'
        }
    }
}

I also added the following lines to the application.groovy file:

grails.plugin.databasemigration.updateOnStart = true
grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.xml']

I would really appreciate any advice on how to work with the database plugin.

Edit:

I created a changelog.xml file using the command $grails dbm-create-changelog

I also added to build.gradle (as suggested by the team $grails plugin-info database-migration):

dependencies {
    compile "org.grails.plugins:database-migration:2.0.0.RC1"
}

then I changed it to (after the official documentation):

dependencies {
    runtime "org.grails.plugins:database-migration:2.0.0.RC1"
}

and then (as suggested by the manual for a startup error), I force the lipibase:

dependencies {
    compile 'org.liquibase:liquibase-core:3.3.2'
    runtime 'org.grails.plugins:database-migration:2.0.0.RC1'
}

and

dependencies {
    compile 'org.liquibase:liquibase-core:3.3.2'
    compile 'org.grails.plugins:database-migration:2.0.0.RC1'
}

The problem remains: java.lang.IllegalArgumentException: Script text to compile cannot be null!

+4
4

Grails 3.

grails-database-migration, , updateOnStartFileNames updateOnStartFileName.

,

grails.plugin.databasemigration.updateOnStartFileNames = ['changelog.xml']

grails.plugin.databasemigration.updateOnStartFileName = 'changelog.xml'

.

+5

. , script, :

include file: 'data/001-tablex-data.groovy'

, - 002 -.... , , , /, . , changelog.groovy changelog.xml

+2

, . , - -. , changelog.groovy( XML Groovy). $grails dbm-create-changelog changelog.groovy. $grails dbm-changelog-sync, .

+1

, :

  • , .. grails-app/migrations/changelog.xml .

, . , .

  1. Your data source is configured to use the database to which it applies changelog.xml.
0
source

Source: https://habr.com/ru/post/1626864/


All Articles