Maven changelogSyncToTag

Last updated: July 14, 2025

The changelogSyncToTag goal marks all undeployed changesets from your changelog up to the specified tag as executed in your database. The goal also marks the changeset with that tag as deployed.

Note: If your changelog file doesn't specify any tags, add them using the tagDatabase Change Type.

Uses

The changelogSyncToTag goal is typically used when you want to baseline a new database environment with specific objects. An example use case for the changelogSyncToTag goal is the following:

  1. You have a DEV environment with a set of objects used only in DEV, and you want to use the same changelog to manage a new TEST environment. The TEST environment does not have those DEV-only objects and needs only some of them.

  2. To deploy the needed DEV-only objects and avoid deploying the rest, you add a tag and run the changelogSyncToTag goal to mark the changes related to that tag as executed in the DATABASECHANGELOG table.

  3. The goal marks all changesets starting with the first changeset at the top of the DEV changelog file and moving down to the changesets up to and including the tag.

  4. Next, you deploy the changesets that were not marked as deployed in your database. Liquibase treats your DEV and TEST databases as equivalent.

Note: Use the Maven changelogSync goal to mark all undeployed changes from the changelog file as executed in your database.

You can also use the changelogSyncToTag goal to mark the change associated with a specific tag as executed if the object associated with the change was created manually in the database. Marking the changeset as executed prevents the next Liquibase update from failing as it tries to create an object that already exists.

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.

Running the changelogSyncToTag Maven goal

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

mvn liquibase:changelogSyncToTag -Dliquibase.toTag=version_2.0

Enter the name of the tag that you want to use in place of version_2.0. Alternatively, you can add the goal and its attributes to the <executions> section of your pom.xml:

<executions> <execution> <phase>process-resources</phase> <goals> <goal>changelogSyncToTag</goal> </goals> <configuration> <toTag>version_2.0</toTag> </configuration> </execution> </executions>

Maven changelogSyncToTag configuration attributes

Required Maven changelogSyncToTag configuration attributes

Attribute

Definition

liquibase.toTag

Syncs the changesets up to and including the tag.

Maven changelog SyncToTag output

Starting Liquibase at 04:15:23 (version 4.3.2 #44 built at 2021-03-23 14:01+0000) [INFO] Parsing Liquibase Properties File local.liquibase.properties for changeLog parameters [INFO] Executing on Database: jdbc:oracle:thin:@localhost:1521/ORCL [INFO] Successfully acquired change log lock [INFO] Reading from DATABASECHANGELOG [INFO] Successfully released change log lock [INFO] Successfully acquired change log lock Skipping auto-registration [WARNING] Skipping auto-registration [INFO] Successfully released change log lock [INFO] ------------------------------------------------------------------------ [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.640 s [INFO] Finished at: 2021-03-31T04:15:25-05:00 [INFO] ------------------------------------------------------------------------