Grails数据库迁移因LiquibaseException而失败

时间:2013-08-19 21:08:57

标签: grails database-migration liquibase

我正在使用Grails database migration plugin

这是我的配置:

grails.plugin.databasemigration.updateOnStart = true
grails.plugin.databasemigration.updateOnStartFileNames = 'changelog.groovy'

当我启动我的应用程序时,我得到了这个例外:

| Error 2013-08-20 08:55:47,356 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: liquibase.exception.LiquibaseException: Cannot find parser that supports c
Message: liquibase.exception.LiquibaseException: Cannot find parser that supports c
    Line | Method
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . in java.lang.Thread

Caused by LiquibaseException: Cannot find parser that supports c
->>   61 | getParser in liquibase.parser.ChangeLogParserFactory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    623 | listUnrunChangeSets in liquibase.Liquibase
|     67 | doCall .  in grails.plugin.databasemigration.MigrationRunner$_autoRun_closure1
|    132 | executeInSession in grails.plugin.databasemigration.MigrationUtils
|     56 | autoRun . in grails.plugin.databasemigration.MigrationRunner
|     96 | doCall    in DatabaseMigrationGrailsPlugin$_closure2
|    334 | innerRun  in java.util.concurrent.FutureTask$Sync
|    166 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    724 | run . . . in java.lang.Thread

任何想法为什么?

1 个答案:

答案 0 :(得分:3)

问题是updateOnStartFileNames属性采用数组而不是字符串,因此配置应为

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

插件迭代遍历此列表,依次执行每个列表,但是当给定一个String时,它会迭代每个字符并执行它。 Liquibase然后抛出异常,因为它不识别第一个字母的后缀,在这种情况下,'c'。