What is the liquibase.properties file?

You can use a defaults file called liquibase.properties to store information that Liquibase needs to connect to a particular database, along with other properties that rarely change. This lets you avoid entering properties through your command line, saving you time and reducing errors.

Arguments that are entered at a command prompt override values that are specified in liquibase.properties.

Ways to create a liquibase.properties file

Liquibase comes preinstalled with example liquibase.properties files in the $LIQUIBASE_HOME/examples/<sql|xml|yaml|json> directories. By default, when you run a command, Liquibase looks for the liquibase.properties file in the directory Liquibase is running in.

There are three ways to create a defaults file:

  • You can automatically generate a liquibase.properties file by running the init project command to create a new Liquibase project.

  • You can also manually create a new text file in your project Liquibase directory and name it liquibase.properties.

  • You can specify a custom name and location for your defaults file by using the --defaults-file parameter. For more information, see Working with Command Parameters.

Example defaults file

The following example liquibase.properties file works for an Oracle database:

changelogFile: ../path/to/file/dbchangelog.xml
driver: oracle.jdbc.OracleDriver
url: jdbc:oracle:thin:@192.168.0.22:1521/orcl
referenceDriver: oracle.jdbc.OracleDriver
referenceUrl: jdbc:oracle:thin:@192.168.0.22:1521/orcl
licenseKey: aeioufakekey32aeioufakekey785463214
classpath: ../path/to/file/ojdbc6-11.2.0.3.0.jar

This example does not include authentication properties such as username, password, referenceUsername, and referencePassword. It is a best practice to include sensitive credentials in a Secrets Management tool like AWS Secrets Manager or HashiCorp Vault. These tools require a Liquibase Pro license key.

Tip: You do not need to specify a classpath for pre-installed drivers in the liquibase/internal/lib directory or for drivers you placed in the liquibase/lib directory. If placed your database's JDBC JAR file in a different directory, you must specify the path: classpath:../<path_to_drivers>/<db_jar_name>.jar.

Note: The Liquibase properties file does not support quoted property values, such as driver: "oracle.jdbc.OracleDriver". However, you can use quoted and unquoted values in the CLI.

You can see all properties that are available to be used with liquibase.properties in the Liquibase parameters.