Liquibase:链接来自测试的主要Yaml Changelog [英] Liquibase : link main yaml changelog from test

查看:1091
本文介绍了Liquibase:链接来自测试的主要Yaml Changelog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从src/test/resources中的src/main/resources ..链接yaml数据库创建规则,并添加一个带有示例数据的chagngelog.

I want to link yaml database creation rules from src/main/resources.. in src/test/resources and add one more chagngelog with sample data.

src \ test \ resources \ db \ changelog \ db.changelog-master.yaml:

src\test\resources\db\changelog\db.changelog-master.yaml :

databaseChangeLog:
- include:
    file: ../../main/resources/db/changelog/db.changelog-master.yaml
- include:
    file: db/changelog/marketplace/sampleData.yaml

但是它不起作用.因此,错误是:解析../../main/resources/db/changelog/db.changelog-master.yaml

But it doesn't work. So, the error is : Error parsing ../../main/resources/db/changelog/db.changelog-master.yaml

还有其他选项可以从main链接主要资源吗? 这是一个春季启动项目.

Is there any other options to link main resources from main? This is a spring boot project.

错误堆栈跟踪:

Caused by: liquibase.exception.ChangeLogParseException: Error parsing classpath:/db/changelog/db.changelog-master.yaml
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:84)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:217)
at liquibase.Liquibase.update(Liquibase.java:190)
at liquibase.Liquibase.update(Liquibase.java:179)
at 

...

Caused by: java.io.FileNotFoundException: class path resource [../../main/resources/db/changelog/db.changelog-master.yaml] cannot be resolved to URL because it does not exist
at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:195)
at liquibase.integration.spring.SpringLiquibase$SpringResourceOpener.getResourcesAsStream(SpringLiquibase.java:504)
at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:186)
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:27)
... 52 more

推荐答案

我建议以不同的方式命名位于测试路径中的changelog文件,因为在测试过程中,main/test路径合并为一个相对路径,测试套件运行.我怀疑Liquibase认为您正在尝试递归地包含相同的文件.

I would suggest to name changelog file located in test path differently, because during test, main/test paths are merged into one relative path for the test suite run. I suspect Liquibase thinks that you are trying to include same file recursively.

只需将测试路径下的db.changelog-master.yaml重命名为db.changelog-master-test.yaml

Just rename your db.changelog-master.yaml under test path to db.changelog-master-test.yaml

这篇关于Liquibase:链接来自测试的主要Yaml Changelog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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