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 |
---|---|
| Specifies the author for changesets in the generated changelog. |
| Specifies the execution context to be used for changesets in the generated changelog, which can be |
| Specifies the catalog Liquibase will use to create your changelog tables. |
| Specifies the schema Liquibase will use to create your changelog tables. |
| Boolean. Forces checksums to be cleared from the DATABASECHANGELOG table. Default value is: false. |
| 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. |
| Specifies the table name to use for the DATABASECHANGELOG table. |
| Specifies the table name to use for the DATABASECHANGELOG table. |
| Specifies the database object class. |
| Specifies the default catalog name to use for the database connection. |
| Specifies the default schema name to use for the database connection. |
| Specifies objects to be excluded from the changelog. Example filters: |
| Boolean. Includes the catalog in the |
| Specifies objects to be included in the changelog. Example filters: |
| Specifies the list of 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 |
| Specifies the driver class name to use for the database connection. |
| Specifies the location of a JDBC connection properties file which contains properties the driver will use. |
| Deprecated. Boolean. Use an empty or null value for the password instead. Default value is: false. |
| Specifies a map-based collection of changelog properties to apply. |
| Specifies a property-based collection of changelog properties to apply. |
| Specifies the format in which to display the |
| Boolean. Includes a Maven project artifact in the class loader, which obtains the Liquibase properties file and changelog files. Default value is |
| Boolean. Includes the Maven test output directory in the class loader which obtains the Liquibase properties file and changelog files. Default value is |
| Specifies your Liquibase Pro license key. |
| Boolean. Specifies whether to ignore the catalog or database name. Default value is: false. |
| Boolean. Specifies whether to ignore the schema name. Default value is: false. |
| Writes the |
| Indicates that you want to set the character encoding of the output file during the |
| Outputs schema names. This is a CSV list. |
| Specifies the database password for the database connection. |
| Deprecated. Boolean. Controls whether users are prompted before executing changesets to a non-local database. Default value is: true. |
| Specifies the Liquibase properties file to use for configuration, like |
| Boolean. Indicates that you want the |
| Specifies the property provider, which must be a |
| Specifies the server ID in the Maven |
| 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. |
| Specifies a list of system properties you want to pass to the database. |
| Specifies the database URL you want to use to execute Liquibase. |
| Specifies the database username for the database connection. |
| 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] ------------------------------------------------------------------------