Maven Properties

You can set Liquibase Maven properties to change the behavior of your commands. You can pass arguments, like changelog-file, in Maven in the following ways:

  • Directly in your pom.xml file.

  • In a liquibase.properties file referenced in your POM.

  • As environment variables.

  • As JVM system properties.

Tags like expressionVariables, expressionVars, and systemProperties can only be set in your POM.

For a list of properties you can set, see the property tables on pages for individual Maven Goals.

Note: You can also run the Maven help goal: mvn liquibase: help -Ddetail=true.

Syntax

Directly in your POM

The <configuration> section of the POM, within the <plugin> section for Liquibase, allows you to specify settings that Liquibase will use when it runs. The settings control Liquibase's behavior by specifying the attributes Liquibase uses during execution. For example:

<configuration> <changeLogFile>changelog.xml</changeLogFile> <url>MyJDBCConnection</url> <username>dbuser</username> <password>dbpassword</password> </configuration>

Referencing the liquibase.properties file

Note: If you use liquibase.properties or a custom Liquibase properties file, it must be located in the src/main/resources directory or another place in the search path.

<configuration> <propertyFile>liquibase.properties</propertyFile> </configuration>

Then, in your liquibase.properties file, specify the properties as follows:

changeLogFile=changelog.xml url=MyJDBCConnection username=dbuser password=dbpassword

For more information, see Create and Configure a liquibase.properties File.

Full pom.xml example

Depending on your project and the Maven goals you want to run, you might need a specific pom.xml configuration. The following is a basic example of how you can implement it and where the <plugin> tag can typically appear inside the overall structure.

Note: You can add another section, modify the existing ones, and configure them in your own way. For more information, see Using Liquibase and your Maven POM File.

<!-- Typical Maven header information --> <project xmlns="http://maven.apache.org/POM/3.6.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/3.6.3 http://maven.apache.org/xsd/maven-3.6.3.xsd"> <modelVersion>3.6.3</modelVersion> <!-- Typical Maven information for your project --> <groupId>com.my.thing</groupId> <artifactId>GenChangeLogTest</artifactId> <version>1.0</version> <!-- Maven hierarchy of elements for your project --> <build> <pluginManagement> <plugins> <plugin> <!-- Basic information to get Liquibase plugin: include <groupId>, <artifactID>, and <version> elements --> <groupId>org.liquibase</groupId> <artifactId>liquibase-maven-plugin</artifactId> <version>4.33.0</version> <configuration> <!-- Set values for Liquibase properties and settings for example, the location of a properties file to use --> <propertyFile>liquibase.properties</propertyFile> </configuration> <dependencies> <!-- Set up any dependencies for Liquibase to function in your environment for example, a database-specific plugin --> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <version>2.1.214</version> </dependency> </dependencies> </plugin> </plugins> </pluginManagement> </build> </project>

Maven Properties - Liquibase