Liquibase includeAll标签被忽略 [英] Liquibase includeAll tag is ignored

查看:497
本文介绍了Liquibase includeAll标签被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在这里.

我们有一个 Spring Boot 1.4.0 应用程序,并且正在使用 Liquibase 3.5.1 进行数据库管理.

We have a Spring Boot 1.4.0 application and we're using Liquibase 3.5.1 for our DB management.

我们所有的变更集文件都位于/src/main/resources/db/changelog中,它们具有以下命名模式:[semanticVersion]-[descriptor].yml

All of our individual changeset files are located in /src/main/resources/db/changelog and they have the following naming schema: [semanticVersion]-[descriptor].yml

但是,主变更日志位于运行时依赖项中.

The master changelog, however, is located inside a runtime dependency.

db.changelog-master.yaml

databaseChangeLog:
  - changeSet:
      id: 1.0.1
      author: atlassian
      changes:
        - createTable:
            //code omitted for brevity
  - includeAll:
      path: classpath*:db/changelog
      errorIfMissingOrEmpty: false

现在是问题所在.

通过IDEA运行应用程序,所有变更集均已加载并应用于我们的数据库.

Running the application through IDEA all of the changesets are loaded and applied to our DB.

但是,当我使用Spring Boot Gradle插件构建一个胖jar(bootRepackage任务),然后继续使用java -jar [project].jar运行它时,找到了主变更日志,该表已创建,但所有其他文件似乎都已建立..被忽略. databasechangelog表仅显示 1.0.1 更新,仅此而已.有趣的事实是,如果将error属性设置为true,则只有在我还将path捏成无法解决的情况时,它才会失败.这样看来,找到目录就好了.

However when I use the Spring Boot Gradle plugin to build a fat jar (bootRepackage task) and then proceed to run it with java -jar [project].jar the master changelog is found, the table is created but all the other files are seemingly.. ignored. databasechangelog table only shows the 1.0.1 update and that's it. Fun fact, if I set the error property to true it only fails once I also fudge the path to something unresolvable. So it seems like the directory is found just fine.

NB!所有.yml文件都在胖子罐中,经过检查和再次检查:)

NB! All the .yml files are inside the fat jar, checked and double-checked :)

我还尝试将它们重命名为.yaml,我尝试将它们替换为相应的.xml文件,但没有解决任何问题.

I have also tried renaming them to .yaml, I've tried replacing them with corresponding .xml files, nothing is resolved.

我在Google,Stack和Liquibase JIRA上进行了研究,结果发现只有很少的提及,从我读到的内容来看,在 3.5.1 上,此问题应该已得到解决.但没有骰子.

I dug around on Google, Stack and Liquibase JIRA and found out only a handful of mentions of this happening and from what I read, on 3.5.1 this problem should've been fixed.. but no dice.

如果我将Liquibase依赖项切换回 3.4.2 (作为可能的解决方案提到)并运行jar,我会得到数千行异常,最终出现Exception的说法db.changelog-master.yaml无法识别为正确的文件,并且找不到DatabaseChangeLog节点.

If I switch the Liquibase dependency back to 3.4.2 (which was mentioned as a possible solution) and run the jar I get a few thousand lines of exceptions that culminate with an Exception saying that db.changelog-master.yaml is not recognized as a proper file and DatabaseChangeLog node cannot be found.

如果我想念任何重要信息,我会尽量保持冗长.

If I missed any important information just let me know, I tried to be as verbose as possible.

推荐答案

在liquibase的更高版本中,此问题似乎已得到解决,而不是Spring Boot当前设置的版本.

This seems to be fixed in a later version of liquibase than what is currently set by spring boot.

通过以下方式覆盖版本:

Override the version via:

ext["liquibase.version"] = "3.5.4"

此外,请知道此问题仍然存在于 spring boot 1.5

Also, know that this issue still exists in spring boot 1.5

引用: https://liquibase.jira.com/browse/CORE-2863

这篇关于Liquibase includeAll标签被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆