Maven generateChangeLog

Last updated: July 14, 2025

The generateChangeLog goal creates a changelog file that has a sequence of changesets which describe how to re-create the current state of the database.

Uses

The generateChangeLog goal is typically used when you want to capture the current state of a database, then apply those changes to any number of databases. This is typically only done when a project has an existing database but hasn't used Liquibase before.

Note: When using the update goal to apply the changes in the changelog, Liquibase will not create a new database or schema. You must create them before applying the changelog to it.

Maven configuration

You can configure Liquibase Maven in multiple ways. You can pass arguments like <changeLogFile> in Maven directly in your pom.xml file, in a liquibase.properties file referenced in your POM, as environment variables, or as JVM system properties. To learn about each file's syntax, see Maven Properties.

Tip: For more information about the Maven configuration, see Configuring Maven.

Before running the generateChangeLog goal, add <outputChangeLogFile>specify the changelog file name you want to generate here</outputChangeLogFile> to your pom.xml file or specify it in another way.

Running the generateChangeLog Maven goal

Running the generateChangeLog goal requires a Maven project to be implemented. To run the goal, type the following in your command prompt:

mvn liquibase:generateChangeLog

Liquibase generateChangelog changelog examples

Liquibase OSS generateChangelog changelog example

When using Liquibase Open Source, the Maven example shown earlier will generate an XML file that might look like the following:

<changeSet author="diff-generated" id="1185214997195-1"> <createTable name="BONUS"> <column name="ENAME" type="VARCHAR2(10,0)"/> <column name="JOB" type="VARCHAR2(9,0)"/> <column name="SAL" type="NUMBER(22,0)"/> <column name="COMM" type="NUMBER(22,0)"/> </createTable> </changeSet> <changeSet author="diff-generated" id="1185214997195-2"> <createTable name="DEPT"> <column name="DEPTNO" type="NUMBER(2,0)"/> <column name="DNAME" type="VARCHAR2(14,0)"/> <column name="LOC" type="VARCHAR2(13,0)"/> </createTable> </changeSet> <changeSet author="diff-generated" id="1185214997195-3"> <createTable name="EMP"> <column name="EMPNO" type="NUMBER(4,0)"/> <column name="ENAME" type="VARCHAR2(10,0)"/> <column name="JOB" type="VARCHAR2(9,0)"/> <column name="MGR" type="NUMBER(4,0)"/> <column name="HIREDATE" type="DATE(7,0)"/> <column name="SAL" type="NUMBER(7,2)"/> <column name="COMM" type="NUMBER(7,2)"/> <column name="DEPTNO" type="NUMBER(2,0)"/> </createTable> </changeSet> <changeSet author="diff-generated" id="1185214997195-4"> <createTable name="SALGRADE"> <column name="GRADE" type="NUMBER(22,0)"/> <column name="LOSAL" type="NUMBER(22,0)"/> <column name="HISAL" type="NUMBER(22,0)"/> </createTable> </changeSet> <changeSet author="diff-generated" id="1185214997195-5"> <addForeignKeyConstraint baseColumnNames="DEPTNO" baseTableName="DEPT" constraintName="FK_NAME" referencedColumnNames="DEPTNO" referencedTableName="EMP"/> </changeSet> <changeSet author="diff-generated" id="1185214997195-6"> <createIndex indexName="PK_DEPT" tableName="DEPT"> <column name="DEPTNO"/> </createIndex> </changeSet> <changeSet author="diff-generated" id="1185214997195-7"> <createIndex indexName="PK_EMP" tableName="EMP"> <column name="EMPNO"/> </createIndex> </changeSet> <changeSet author="diff-generated" id="1185214997195-8"> <addPrimaryKey columnNames="DEPTNO" tableName="DEPT"/> </changeSet> <changeSet author="diff-generated" id="1185214997195-9"> <addPrimaryKey columnNames="EMPNO" tableName="EMP"/> </changeSet> </databaseChangeLog>

Optional Maven generateChangelog configuration attributes

Optional Maven generateChangeLog configuration attributes

Attribute

Definition

liquibase.changeSetAuthor

Specifies the author for changesets in the generated changelog.

liquibase.changeSetContext

Specifies the execution context to be used for changesets in the generated changelog, which can be "," separated if there are multiple contexts.

liquibase.changelogCatalogName

Specifies the catalog Liquibase will use to create your changelog tables.

liquibase.changelogSchemaName

Specifies the schema Liquibase will use to create your changelog tables.

liquibase.clearCheckSums

Boolean. Forces checksums to be cleared from the DATABASECHANGELOG table. Default value is: false.

liquibase.contexts

Specifies which contexts Liquibase will execute, which can be separated by a comma if multiple contexts are required. If a context is not specified, then all contexts will be executed.

liquibase.databaseChangeLogLockTableName

Specifies the table name to use for the DATABASECHANGELOG table.

liquibase.databaseChangeLogTableName

Specifies the table name to use for the DATABASECHANGELOG table.

liquibase.databaseClass

Specifies the database object class.

liquibase.defaultCatalogName

Specifies the default catalog name to use for the database connection.

liquibase.defaultSchemaName

Specifies the default schema name to use for the database connection.

liquibase.diffExcludeObjects

Specifies objects to be excluded from the changelog. Example filters: "table_name", "table:main_.*", "column:*._lock, table:primary.*".

liquibase.diffIncludeCatalog

Boolean. Includes the catalog in the diff output. If this is null, then the catalog will not be included.

liquibase.diffIncludeObjects

Specifies objects to be included in the changelog. Example filters: "table_name", "table:main_.*", "column:*._lock, table:primary.*".

liquibase.diffTypes

Specifies the list of diff types to include in the changelog, expressed as a comma-separated list from:

Tables, views, columns, indexes, foreignkeys, primary keys, uniqueconstraints, data

If this is null, then the default types will be:

Tables, views, columns, indexes, foreignkeys, primary keys, uniqueconstraints

liquibase.driver

Specifies the driver class name to use for the database connection.

driverPropertiesFile

Specifies the location of a JDBC connection properties file which contains properties the driver will use.

liquibase.emptyPassword

Deprecated. Boolean. Use an empty or null value for the password instead. Default value is: false.

expressionVariables

Specifies a map-based collection of changelog properties to apply.

expressionVars

Specifies a property-based collection of changelog properties to apply.

liquibase.format

Specifies the format in which to display the diff output. This format can be TXT or JSON.

liquibase.includeArtifact

Boolean. Includes a Maven project artifact in the class loader, which obtains the Liquibase properties file and changelog files. Default value is true.

liquibase.includeTestOutputDirectory

Boolean. Includes the Maven test output directory in the class loader which obtains the Liquibase properties file and changelog files. Default value is true.

liquibase.licenseKey

Specifies your Liquibase Pro license key.

liquibase.outputDefaultCatalog

Boolean. Specifies whether to ignore the catalog or database name. Default value is: false.

liquibase.outputDefaultSchema

Boolean. Specifies whether to ignore the schema name. Default value is: false.

liquibase.outputFile

Writes the diff output to a file.

liquibase.outputFileEncoding

Indicates that you want to set the character encoding of the output file during the updateSQL phase.

liquibase.outputSchemas

Outputs schema names. This is a CSV list.

liquibase.password

Specifies the database password for the database connection.

liquibase.promptOnNonLocalDatabase

Deprecated. Boolean. Controls whether users are prompted before executing changesets to a non-local database. Default value is: true.

liquibase.propertyFile

Specifies the Liquibase properties file to use for configuration, like liquibase.properties.

liquibase.propertyFileWillOverride

Boolean. Indicates that you want the liquibase.properties file to override any settings provided in the Maven plugin configuration. By default, if a property is explicitly specified, it is not overridden if it also appears in the properties file. Default value is: false.

liquibase.propertyProviderClass

Specifies the property provider, which must be a java.util.Properties implementation.

liquibase.server

Specifies the server ID in the Maven settings.xml to use when authenticating.

liquibase.skip

Boolean. Specifies whether to skip running Liquibase. The use of this attribute is not recommended but can be used when needed. Default value is: false.

systemProperties

Specifies a list of system properties you want to pass to the database.

liquibase.url

Specifies the database URL you want to use to execute Liquibase.

liquibase.username

Specifies the database username for the database connection.

liquibase.verbose

Boolean. Controls the amount of output detail when you call the plugin. Default value is: false.

Maven generateChangeLog output

The generateChangeLog goal generates a changelog that contains all your objects (represented as changesets) and places the file in the same directory where the goal was run.

The extension provided determines the format of the changelog, so if you specify the filename as changelog.xml you will get an XML formatted changelog. However, if you specify the filename as changelog.yaml or changelog.json or changelog.postgresql.sql you will get changelogs formatted in YAML or JSON or SQL, respectively.

Note: When generating an SQL formatted changelog, you must specify the short name of the targeted database type as part of the filename.

When successful, the generateChangeLog Maven goal produces the following output:

Starting Liquibase at 10:35:51 (version 4.1.1 #10 built at 2020-10-12 19:24+0000) [INFO] Parsing Liquibase Properties File local.liquibase.properties for changeLog parameters [INFO] Executing on Database: jdbc:oracle:thin:@localhost:1521/ORCL [INFO] Generating Change Log from database MVN_UAT @ jdbc:oracle:thin:@localhost:1521/ORCL (Default Schema: MVN_UAT) BEST PRACTICE: The changelog generated by diffChangeLog/generateChangeLog should be inspected for correctness and completeness before being deployed [INFO] changeSets count: 1 [INFO] dbchangelog.xml does not exist, creating and adding 1 changesets. [INFO] Output written to Change Log file, dbchangelog.xml [INFO] ------------------------------------------------------------------------ [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 9.373 s [INFO] Finished at: 2020-11-25T10:35:57-06:00 [INFO] ------------------------------------------------------------------------

Maven generateChangeLog - Liquibase