You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying again to upgrade Bootique.io framework to Liquibase 4.x from 3.x. An earlier issue #3105 was fixed in LB 4.17, and helped us to move forward. However, there are still a few places where the base path of a resource is altered, so the relative resources can not be properly resolved inside a custom ResourceAccessor. The culprit is stripping the classpath: prefix during path normalization. So this change to DatabaseChangeLog.normalizePath(..) fixes everything for me:
--- a/liquibase-standard/src/main/java/liquibase/changelog/DatabaseChangeLog.java
+++ b/liquibase-standard/src/main/java/liquibase/changelog/DatabaseChangeLog.java
@@ -1028,10 +1028,6 @@ public class DatabaseChangeLog implements Comparable<DatabaseChangeLog>, Conditi
return null;
}
- if (filePath.startsWith("classpath:")) {
- filePath = filePath.substring("classpath:".length());
- }
-
if (filePath.contains("\\")) {
filePath = filePath.replace("\\", "/");
}
But I suspect such a change may break things elsewhere, so not sending a PR just yet 😀 Instead, let me point to some of the call spots for normalizePath(..) that resulted in broken relative resources, and maybe someone can suggest a proper solution, such as an alternative normalize method that preserves the "protocol" prefix in paths:
Caused by: liquibase.exception.LiquibaseException: Error parsing classpath:io/bootique/jdbc/junit5/derby/DerbyTester_Liquibase_RelativeIT-changelog.yml : java.io.FileNotFoundException: /Users/andrus/work/bootique/bootique-jdbc/bootique-jdbc-junit5-derby/io/bootique/jdbc/junit5/derby/changelogs/changelog.sql (No such file or directory)
at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:987)
at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:907)
at io.bootique.jdbc.liquibase.LiquibaseRunner.lambda$createDatabaseChangeLog$0(LiquibaseRunner.java:108)
... 17 more
Caused by: liquibase.exception.ChangeLogParseException: Error parsing classpath:io/bootique/jdbc/junit5/derby/DerbyTester_Liquibase_RelativeIT-changelog.yml : java.io.FileNotFoundException: /Users/andrus/work/bootique/bootique-jdbc/bootique-jdbc-junit5-derby/io/bootique/jdbc/junit5/derby/changelogs/changelog.sql (No such file or directory)
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:96)
at liquibase.changelog.DatabaseChangeLog.lambda$include$4(DatabaseChangeLog.java:957)
at liquibase.Scope.child(Scope.java:199)
at liquibase.Scope.child(Scope.java:175)
at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:956)
... 19 more
Caused by: liquibase.exception.SetupException: java.io.FileNotFoundException: /Users/andrus/work/bootique/bootique-jdbc/bootique-jdbc-junit5-derby/io/bootique/jdbc/junit5/derby/changelogs/changelog.sql (No such file or directory)
at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:465)
at liquibase.changelog.DatabaseChangeLog.load(DatabaseChangeLog.java:390)
at liquibase.parser.core.yaml.YamlChangeLogParser.parse(YamlChangeLogParser.java:90)
... 23 more
Caused by: liquibase.exception.LiquibaseException: java.io.FileNotFoundException: /Users/andrus/work/bootique/bootique-jdbc/bootique-jdbc-junit5-derby/io/bootique/jdbc/junit5/derby/changelogs/changelog.sql (No such file or directory)
at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:987)
at liquibase.changelog.DatabaseChangeLog.handleChildNode(DatabaseChangeLog.java:455)
... 25 more
Caused by: liquibase.exception.ChangeLogParseException: java.io.FileNotFoundException: /Users/andrus/work/bootique/bootique-jdbc/bootique-jdbc-junit5-derby/io/bootique/jdbc/junit5/derby/changelogs/changelog.sql (No such file or directory)
at liquibase.parser.core.sql.SqlChangeLogParser.parse(SqlChangeLogParser.java:54)
at liquibase.changelog.DatabaseChangeLog.include(DatabaseChangeLog.java:959)
... 26 more
Expected/Desired Behavior
The framework code setting DatabaseChangeLog.physicalFilePath (either via constructor or setter) should not strip an optional "protocol" (such as classpath:) from the path. This will allow to apply the same protocol to relative child resources.
Liquibase Version
4.27.0
Database Vendor & Version
No response
Liquibase Integration
Bootique.io
Liquibase Extensions
No response
OS and/or Infrastructure Type/Provider
No response
Additional Context
No response
Are you willing to submit a PR?
I'm willing to submit a PR (Thank you!)
The text was updated successfully, but these errors were encountered:
Hi @andrus, thank you for reporting this issue.
This is a complex topic, as some users need the classpath: to be stripped when normalizing the path, and others need it to not be stripped.
But I suspect such a change may break things elsewhere, so not sending a PR just yet 😀
I'd recommend the opposite, considering that you have a possible solution - if you submit a PR we can test it and see what/if it breaks. Our development team is always available to provide guidance or discuss changes if needed.
Please consider submitting a PR, and let me know if you have any questions.
Thank you!
Tatiana
Search first
Description
I am trying again to upgrade Bootique.io framework to Liquibase 4.x from 3.x. An earlier issue #3105 was fixed in LB 4.17, and helped us to move forward. However, there are still a few places where the base path of a resource is altered, so the relative resources can not be properly resolved inside a custom ResourceAccessor. The culprit is stripping the
classpath:
prefix during path normalization. So this change toDatabaseChangeLog.normalizePath(..)
fixes everything for me:But I suspect such a change may break things elsewhere, so not sending a PR just yet 😀 Instead, let me point to some of the call spots for
normalizePath(..)
that resulted in broken relative resources, and maybe someone can suggest a proper solution, such as an alternative normalize method that preserves the "protocol" prefix in paths:liquibase/liquibase-standard/src/main/java/liquibase/parser/core/yaml/YamlChangeLogParser.java
Line 46 in d956d5f
liquibase/liquibase-standard/src/main/java/liquibase/parser/core/xml/AbstractChangeLogParser.java
Line 20 in d956d5f
liquibase/liquibase-standard/src/main/java/liquibase/changelog/DatabaseChangeLog.java
Line 969 in d956d5f
Steps To Reproduce
This test on branch 123 fails: https://github.com/bootique/bootique-jdbc/blob/123/bootique-jdbc-junit5-derby/src/test/java/io/bootique/jdbc/junit5/derby/DerbyTester_Liquibase_RelativeIT.java
Expected/Desired Behavior
The framework code setting
DatabaseChangeLog.physicalFilePath
(either via constructor or setter) should not strip an optional "protocol" (such asclasspath:
) from the path. This will allow to apply the same protocol to relative child resources.Liquibase Version
4.27.0
Database Vendor & Version
No response
Liquibase Integration
Bootique.io
Liquibase Extensions
No response
OS and/or Infrastructure Type/Provider
No response
Additional Context
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: