+-

试图像这样整合。build.gradle
dependencies {
implementation 'org.liquibase:liquibase-core'
implementation 'org.liquibase:liquibase-groovy-dsl:2.1.1'
runtimeOnly 'com.h2database:h2'
runtime 'org.liquibase:liquibase-core'
runtime 'org.liquibase:liquibase-groovy-dsl:2.1.1'
}
在Spring Boot的application.properties中
spring.liquibase.changeLog=classpath:db/changelog/changeset0002.groovy
有相应的 changeset0002.groovy 归入 src/main/resources/db/changelog.
在做 gradle bootRun,得到以下异常。
Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
0
投票
投票
它工作了。在我的 应用程序.属性 文件,并进行了以下设置,我让它工作了。
spring.liquibase.change-log=classpath:META-INF/scripts/changeset0001.groovy
其中的目录 META-INFscripts 存在于 srcmainresources 我的 Gradle 项目结构和 changeset0001.groovy 是一个普通的Groovy DSL文件。