In Liquibase 4.0, specifying files by absolute path was removed. Instead, Liquibase now supports using relative paths or adding ‘/’ to the classpath parameter. This change was made to improve portability and allow for easier migration between different environments or systems.
Let’s take a look at some examples to understand how to use relative paths and the classpath parameter:
-
Relative path example:
Suppose you have a changelog file located in the same directory as the Liquibase executable. You can specify the changelog file using a relative path like this:
<changeLogFile>./changelog.xml</changeLogFile>
-
Classpath parameter example:
If your changelog file is located in a specific directory on the classpath, you can use the classpath parameter to point to the file. For example:
<changeLogFile>classpath:com/example/changelog.xml</changeLogFile>
Make sure to include the package structure (if any) in the classpath.
By using relative paths or the classpath parameter, you can specify files in a more flexible and portable way, making it easier to manage your Liquibase changesets across different environments or systems.