java - Liquibase Groovy-DSL Spring

标签 java spring groovy liquibase spring-shell

我正在开发一个 spring-shell 数据库迁移工具。

目前我尝试将 liquibase 与 groovy-dsl extension 一起使用。 我的 build.gradle 包含扩展 jar,我还在 spring-shell-plugin.xml

中声明了 liquibase

spring-shell-plugin.xml

<bean id="liquibase" class="liquibase.integration.spring.SpringLiquibase" depends-on="postgresService">
    <property name="dataSource" ref="psqlDataSource"/>
    <property name="changeLog" value="com.example.db.DbChangelog_master"/>
    <property name="defaultSchema" value="${postgres.schema}"/>
</bean>

但是每次我启动应用程序 liquibase 都会抛出以下错误

Caused by: liquibase.exception.UnknownChangelogFormatException: Cannot find parser that supports com.example.db.DbChangelog_master
    at liquibase.parser.ChangeLogParserFactory.getParser(ChangeLogParserFactory.java:70)
    at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:226)
    at liquibase.Liquibase.update(Liquibase.java:202)
    at liquibase.Liquibase.update(Liquibase.java:192)
    at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:434)
    at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:391)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
    ... 13 more

文档有点少,jar 也包含在类路径中。

groovy 脚本是否需要位于 src/main/resources 中?目前它们位于 src/main/groovy

中的单独包中

最佳答案

我认为你的属性(property)

<property name="changeLog" value="com.example.db.DbChangelog_master"/>

不正确。这应该是您的变更日志文件的路径。如果该文件是 groovy 文件,则可能是

<property name="changeLog" value="DbChangelog_master.groovy"/>

该文件在类路径上是否可用。

关于java - Liquibase Groovy-DSL Spring,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35895595/

相关文章:

spring - @CamelSpringTest 和@CamelSpringBootTest 有什么区别?

java - Spring中使用@Bean的默认bean id是什么?

java - 组件扫描时如何避免Spring中不需要的bean?

api - 适用于Dropbox的Groovy Rest API,无需第三方插件/库

groovy - 如何在 Groovy 中跳过具有默认值的参数?

java - GWT 在外部函数接口(interface)中返回 null

使用 keystone 身份验证与 swift (OpenStack) 通信的 Java 库

java - 通过 intent 播放 youtube 视频

java - SpringSource 与 eclipse 集成

grails - RestClient Grails 导入失败