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?