【发布时间】:2023-03-31 20:21:01
【问题描述】:
我正在尝试实现 java 触发的 liquibase 数据库更新。
我有以下代码:
java.sql.Connection connection = openConnection(eventContext);
Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));
String changelog = UpgradePanDatabase.class.getResource("/liquibase/db.changelog.xml").getPath();
Liquibase liquibase = new liquibase.Liquibase(changelog, new ClassLoaderResourceAccessor(), database);
liquibase.update(new Contexts(), new LabelExpression());
connection.close();
但我收到以下 ChangeLogParseException:
/Users/ntregillus/myApp/.mule/apps/myApp/classes/liquibase/db.changelog.xml 不存在
但我知道文件存在,我可以复制路径,直接从终端打开它,也可以在文件资源管理器中找到它。为什么 Liquibase 找不到这个文件?
【问题讨论】:
-
为了全面披露,我正在部署的 mule 组件中运行此代码