找不到 Gradle Liquibase 更改日志文件

标签 gradle liquibase build.gradle

在我们的项目中使用 gradle-liquibase 插件并解决所有依赖项。

根据 Gradle liquibase 插件的建议,我有以下 liquibase 任务:

liquibase {
   activities {
   main {      
      changeLogFile 'src/main/resources/db/dbchangelog-master.xml'
      url 'jdbc:mysql://localhost:3306/test'
      username 'XXX'
      password 'XXX'
     } 
  }
 runList = 'main'
}

但是遇到了 liquibase 无法识别 changeLogFile 的问题,尽管日志文件位于项目类路径目录 (src/main/resources/) 中

错误:
Caused by: liquibase.exception.ChangeLogParseException:
src/main/resources/dbchangelog/db.changelog-master.xml does not exist

关于如何解决此类路径相关问题的任何帮助?

最佳答案

只需在 src 目录所在的位置添加一个类路径参数

liquibase {
   activities {
   main {      
      changeLogFile 'src/main/resources/db/dbchangelog-master.xml'
      url 'jdbc:mysql://localhost:3306/test'
      username 'XXX'
      password 'XXX'
      classpath "$rootDir"
     } 
  }
 runList = 'main'
}

关于找不到 Gradle Liquibase 更改日志文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27187979/

相关文章:

gradle - Unresolved reference : launch

bash - 如何通过 bash 脚本设置最新版本的 liquibase?

java - 找不到参数的方法实现()

java - 为什么 Android Material Design 选项卡布局不起作用?

eclipse - 为 libgdx 构建新 Gradle 项目模型时出错

Android Studio - Gradle 设置

spring-boot - spring-boot sql 文件中的 Liquibase 参数

java - Dropwizard 迁移 Liquibase 新变更集未迁移

安卓gradle : All buildTypes are getting executed at the same time

gradle - 使用任务生成依赖关系内部版本号