![](/img/trans.png)
[英]liquibase.exception.ChangeLogParseException: Error Reading Migration File: Found 2 files that match mychanges.xml
[英]liquibase.exception.ChangeLogParseException: ChangeLogFile does not exists
public static void main(String[] args) throws Exception {
//execute("jdbc:postgresql://localhost:5432/JAVA_Test", "Admin", "123456", "org.postgresql.Driver");
execute("jdbc:jtds:sqlserver://localhost:5432/Liquibase_JAVA", "sa", "123456!", "net.sourceforge.jtds.jdbc.Driver");
}
public static void execute(String url, String userName, String password, String driver) throws Exception {
DatabaseConnection dbConnection = new DatabaseConnection(url, driver, userName, password);
Connection conn = dbConnection.getConnection();
Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(conn));
String changeLog = "/job_executor/liquibasechangelog/databaseChangeLog.xml";
Liquibase liquibase = new Liquibase(changeLog, new FileSystemResourceAccessor(), database);
liquibase.update(null);
conn.close();
}
我的项目中有我的changeLogFile。 我收到错误changeLogFile.xml不存在有点奇怪。
有人可以帮我吗,谢谢
您的更改日志文件很可能不存在:
/job_executor/liquibasechangelog/databaseChangeLog.xml
但是那里:
job_executor/liquibasechangelog/databaseChangeLog.xml
请注意第二个路径中的/,因此它将是相对的,而不是绝对的。
我已修复此问题,方法是将liquibasechangelog文件夹(我的xml文件所在的文件夹)添加到构建路径,然后仅通过文件名而不是文件名路径来引用它
像这样
字符串changeLog =“ databaseChangeLog.xml”;
谢谢@DavidX @MichalRorat
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.