relativeToChangeLogFile not working as documented

The manual describes the option relativeToChangeLogFile for the sqlFile tag as:

Indicates whether the file path is relative to the root changelog

However Liquibase 4.3.3 takes this as “relative to the current directory”.

My setup is like this:

I have the following directory structure:


`views.xml` is included from `main.xml` and contains this changeSet:

<changeSet author="...." id="1" runOnChange="true">
  <sqlFile path="views/view_1.sql" 
       splitStatements="true" endDelimiter=";" /> 

I run Liquibase from the parent directory of changelog, e.g.

c:\MyProject> liquibase --changeLogFile=changelog\main.xml ....

This worked fine with Liquibase 2.x and 3.x but in Liquibase 4.3.3 it fails with the following confusing error message:

Unexpected error running Liquibase: The file views/view_1.sql was not found in
    - c:\MyProject\.
    - c:\MyProject\postgresql-42.2.18.jar
Specifying files by absolute path was removed in Liquibase 4.0. Please use a relative path or add '/' to the classpath parameter.

So Liquibase apparently searches the file relative to the current directory, not relative to the master change log file as stated in the manual.

The error message is also confusing as I am not using an absolute file path, but a relative one.

Is there any way to get the 3.x behaviour back? Should I report this as a bug?

I’m seriously considering going back to 3.x because of this. This breaks many projects, and we can’t afford to modify all changelogs because of that - which wouldn’t really help anyway as the “current directory” might be different depending on the environment where this is run (manually, Maven, Jenkins, etc)

Note that <include ... relativeToChangelogFile="true"/> works as expected - so there is a difference in the processing of this attribute between <include> and <sqlFile>. Which makes be think this is a bug even more.

The stacktrace might be interesting as it does not even mention the SQLFileChange class. So this seems to fail before the tag gets to see the file name:

    at liquibase.changelog.DatabaseChangeLog.validate(
    at liquibase.Liquibase.lambda$update$1(
    at liquibase.Scope.lambda$child$0(
    at liquibase.Scope.child(
    at liquibase.Scope.child(
    at liquibase.Scope.child(
    at liquibase.Liquibase.runInScope(
    at liquibase.Liquibase.update(
    at liquibase.Liquibase.update(
    at liquibase.integration.commandline.Main.doMigration(
    at liquibase.integration.commandline.Main$1.lambda$run$0(
    at liquibase.Scope.lambda$child$0(
    at liquibase.Scope.child(
    at liquibase.Scope.child(
    at liquibase.Scope.child(
    at liquibase.integration.commandline.Main$
    at liquibase.integration.commandline.Main$
    at liquibase.Scope.child(
    at liquibase.Scope.child(
    at liquibase.integration.commandline.Main.main(

Hi @truls , since you have a reproducible case, I would file an issue.

Hi @truls , Have you filed an issue for this?

The only workaround I found was to use full path with relativeToChangelogFile set to false