Applies to:
- Liquibase Pro
- Liquibase OSS (Community)
Conditions:
- Liquibase v4.13+
Issue Summary:
Some Liquibase commands can access local files to use in their command. For example, the diff
and diff-changelog
commands can access an offline snapshot file to perform the diff
or diff-changelog
operation. If the local file isn't found in the Liquibase search path, the error message "resource does not exist" will occur.
For example, if there is a snapshot file in the /Users/user1/Documents
directory called snapshot1.json
and Liquibase runs in /Users/liquibase
, you will receive the "Resource does not exist" error message if the Liquibase process tries to access the resource in the /Users/user1/Documents
directory, as that path isn't in the default search path for Liquibase.
Error Message:
Resource does not exist
Root Cause:
Liquibase uses a search path to find files referenced. You can read more about how Liquibase finds files on our How Liquibase Finds Files: Liquibase Search Path page.
When a file that isn't in the Liquibase search path is referenced, the "Resource does not exist" error message occurs.
Resolution:
The path to the resource trying to be accessed needs to be added to the Liquibase search path.
In the previous example, the following paths were used
/Users/user1/Documents/snapshot1.json
/Users/liquibase
For the Liquibase process that runs in /Users/liquibase
to reference the snapshot1.json
file, the /Users/user1/Documents/
path needs to be added to the search path.
Example:
liquibase --search-path=/Users/user1/Documents/ --reference-url=offline:postgres?snapshot=/snapshot1.json diff
You will need to add the paths to any resources that don't exist in the following locations:
- Any paths specified in the classpath setting.
- The current working directory.
- A liquibase_libs directory in the current working directory.
- A lib directory in the Liquibase install location.
- Inside any .zip or .jar files in the
liquibase_libs
orlib
directories.
Comments
0 comments
Article is closed for comments.