Liquibase looks for "db-changelog.xml" file even when the --changeLogFile option refers to the different file

111 Views Asked by At

I have observed a very strange behaviour when running Liquibase command (with liquibase.exe tool) from CMD terminal, on Windows.

I have a project, that's structured as:

my_project
|-src
  |-main
    |-java
    |-resources
      |-db-with-sample-data.xml
    |-webapp
  |-test
    |-java

Now, if I'm in the my_project folder and I run:

liquibase --driver=com.mysql.cj.jdbc.Driver --classpath="C:\mysql-connector-java-8.0.28.jar" --changeLogFile="src\main\resources\db-with-sample-data.xml" --url="jdbc:mysql://localhost:3306/mydb" --username=user --password=password update

I get:

Unexpected error running Liquibase: The file db-changelog.xml was not found in the configured search path:
    - C:\projects\my_project
    - ...(other default paths)

and if I run:

liquibase --driver=com.mysql.cj.jdbc.Driver --classpath="C:\mysql-connector-java-8.0.28.jar" --changeLogFile="sr\main\resources\db-with-sample-data.xml" --url="jdbc:mysql://localhost:3306/mydb" --username=user --password=password update

(pay attention! I changed src to sr)

then I get:

Unexpected error running Liquibase: The file sr\main\resources\db-with-sample-data.xml was not found in the configured search path:
    - C:\projects\my_project
    - ...(other default paths)

Ok, I see, that Liquibse, by default, looks for the --changeLogFile value relative to the folder I run it (because I see where it's looking for for the --changeLogFile value after every run of the liquibase.exe command).

But, why in the first case it reports, it could not find db-changelog.xml and in the second one (when I just removed one letter c) - it then properly parses the --changeLogFile value?

0

There are 0 best solutions below