Basic maven commands for Liquibase with Springboot

Liquibase is a version control system for database systems. This blog gives a quick guide to run the maven liquibase commands.


  1. Create a liquibase project using spring boot and maven.

  2. Give the liquibase-maven plugin in the pom.xml file as given below.

    • Here the tag <propertyFile> will have the MySQL connection and the tag <changeLogFile> will have the location to master changelog file or single changelog file.
  3. Create file that has properties as given below

  1. Create changelog files that contains set of changeSets and give tag to each files.
  2. Changelog files

Sample Changelog master file

      <databaseChangeLog xmlns=""
      <include file="liquibase/changelog-1.0.xml"/> 

Sample Changelog file

     <databaseChangeLog xmlns=""
    <changeSet id="1" author="ab">
        <createTable tableName="DEMO_TABLE">
            <column name="id" type="int"></column>
            <column name="name" type="varchar(50)"></column>
	  <changeSet id="tag-1.0" author="ab">
       <tagDatabase tag="1.0" />

To Update Database using Changelog files:

The update command will execute all the changelog files hence we get the database with the updated tables.

mvn liquibase:update

To Rollback to specific version of changelog file:

The Rollback command will rollback the execution the the verion that is specified on the rollbackTag. In the below example the value 1.0 tag number.

mvn liquibase:rollback -Dliquibase.rollbackTag=1.0

This rollback can also be done by

  • Tag Number - rollback to specific version that can be specified in each changelog files.
  • RollbackCount - rollback by crossing specific number of changesets.
  • RollBackDate - rollback to the version that was available at a specific date.

For updating to specific version of changelog file:

The updation will be done upto the specified version. In the below example the value 1.1 is the version upto which the database needs to be updated.

mvn liquibase:update -Dliquibase.toTag=1.1

For taking snapshot of an existing database:

The generateChangeLog command will take snapshot and store the snapshot in the file as mentioned in outputChangeLogFile. This output file can be of anytype that is supported by liquibase.

mvn liquibase:generateChangeLog -Dliquibase.outputChangeLogFile=d:\output.xml

Written by Aravind

Do you want to know when I post something new?
Then subscribe to my newsletter.