Applies to:
- Liquibase Pro
- Liquibase Open Source (Community)
Conditions:
- Any version of Liquibase Pro or Open Source
Question:
How does Liquibase handle file paths either set in the CLI command or in the liquibase.properties file?
Answer:
There are two styles of file paths used, Windows and Linux.
- Windows-style file paths will use the backslash, "\", character to specify directories
- Example: C:\Users\Administrator\Liquibase\liquibase.properties
- Linux-style file paths will use the forward slash, "/", character to specify directories
- Example: /c/Users/Administrator/Liquibase/liquibase.properties
Both styles can be used in a Liquibase project. However, it depends on where the path is used which determines which version will be accepted.
Command Line Interface (CLI)
When Liquibase runs, the paths provided via CLI arguments are handled by the shell being used. When setting a file path on the CLI, it needs to be in the style that is accepted by the shell in use.
For example, if there is a Windows computer that has both Powershell and Git Bash installed, the path style will need to match the shell in use.
- Powershell (Windows-based)
-
liquibase --defaults-file=C:\Users\Administrator\liquibase_project\liquibase.properties status
-
- Git Bash (Linux-based)
-
liquibase --defaults-file=/c/Users/Administrator/liquibase_project/liquibase.properties status
-
liquibase.properties file
The paths inside the liquibase.properties file are processed via the Java Virtual Machine (JVM). Either the Windows or Linux pathing structure can be used and the JVM will convert the pathing to work for that operating system.
If using the Windows style pathing in the liquibase.properties file, an extra backslash, "\", needs to be added. This is an escaping character inside the JVM, so when including a normal backslash, "\", in a file, it needs to be escaped.
Example: liquibase.searchPath: C:\\Users\\Administrator\\Desktop\\liquibase_files
Comments
0 comments
Article is closed for comments.