目前我尝试将 Liquibase 3.3.3 集成到我的项目中。为了管理我的数据库,我从应用程序中调用 Liquibase,而变更集位于 JAR 文件中
final Liquibase liquibase = new Liquibase( "db/db_changelog_master.xml",
new ClassLoaderResourceAccessor(),
database );
liquibase.update( new Contexts() );
此调用有效并且主变更集已加载。在主变更集中,将加载更多变更集:
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<include file="classpath:db_changelog_1.0.xml"/>
</databaseChangeLog>
问题就从这里开始了,因为 Liquibase 无法找到并加载子变更集。我还尝试了
有什么建议吗?这里有什么问题?
最诚挚的问候!
最佳答案
我的更改日志位于 src/main/resources/db/changelog/dbchange-master.xml 和 dbchange-2.xml 的其他 jar 中
如果我像这样在 master 中包含 dbchange-2.xml
<include file="classpath:/db/changelog/dbchange-2.xml" />
它有效。
关于java - JAR 文件中的 Liquibase 变更集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30725317/