logo Liquibase Maven Plugin

A Maven plugin wraps up some of the functionality of Liquibase

homepage:
fresh index:
last release: 2 months ago, first release: 1 decade ago
packaging: maven-plugin
get this artifact from: central
see this artifact on: search.maven.org


Display vulnerabilities (snyk): Vulnerability check

This chart shows how much is this artifact used as a dependency in other Maven artifacts in Central repository and GitHub:


select version:

Add this snippet into pom.xml inside tag <project><build><plugins>:




Switch to artifact.
goals:
liquibase:changelogSync

Marks all unapplied changes to the database as applied in the change log.

liquibase:changelogSyncSQL

Generates SQL that marks all unapplied changes as applied.

liquibase:changelogSyncToTag

Marks all unapplied changes up to and include a specified tag to the database as applied in the change log.

liquibase:changelogSyncToTagSQL

Generates SQL that marks all unapplied changes up to and including a specified tag as applied.

liquibase:clearCheckSums

Clears all checksums in the current changelog, so they will be recalculated next update.

liquibase:dbDoc

Generates dbDocs against the database.

liquibase:deactivateChangeLog

Deactivates a change log from Hub.

liquibase:diff

Generates a diff between the specified database and the reference database. The output is either a report or a changelog depending on the value of the diffChangeLogFile parameter.

liquibase:dropAll

Drops all database objects in the configured schema(s). Note that functions, procedures and packages are not dropped.

liquibase:futureRollbackSQL

Generates the SQL that is required to rollback the database to current state after the next update.

liquibase:generateChangeLog

Generates a changelog based on the current database schema. Typically used when beginning to use Liquibase on an existing project and database schema.

liquibase:help

Display help information on liquibase-maven-plugin. Call mvn liquibase:help -Ddetail=true -Dgoal=<goal-name> to display parameter details.

liquibase:history

Outputs history of deployments against the configured database.

liquibase:listLocks

Lists all Liquibase updater locks on the current database.

liquibase:registerChangeLog

Registers a change log with Hub.

liquibase:releaseLocks

Removes any Liquibase updater locks from the current database.

liquibase:rollback

Invokes Liquibase to rollback the database (and mark changesets as unapplied). The change sets to be rolled back are specified using attributes 'rollbackCount', 'rollbackTag' and/or 'rollbackDate'

liquibase:rollbackOneChangeSet

Reverts (rolls back) one non-sequential changeSet made during a previous change to your database. It is only available for Liquibase Pro users.

liquibase:rollbackOneChangeSetSQL

Displays the SQL which will be executed when the corresponding rollbackOneChangeSet command is executed. This command does not perform the actual rollback. A Liquibase Pro license key is required.

liquibase:rollbackOneUpdate

Rolls back all changesets from any specific update, if all changesets can be rolled back. By default, the last update is rolled back, but an optional deployentId parameter can target any update. (Liquibase Pro only).

liquibase:rollbackOneUpdateSQL

Displays the SQL which will be executed when the corresponding rollbackOneUpdate command is executed. This command does not perform the actual rollback. A Liquibase Pro license key is required.

liquibase:rollbackSQL

Generates the SQL that is required to rollback the database using one or more of the specified attributes 'rollbackCount', 'rollbackTag' and/or 'rollbackDate'

liquibase:status

Prints which changesets need to be applied to the database.

liquibase:syncHub

Syncs all changes in change log with Hub.

liquibase:tag

Writes a Liquibase tag to the database.

liquibase:unexpectedChangeSets

Print a list of changesets that have been executed but are not in the current changelog

liquibase:update

Applies the DatabaseChangeLogs to the database. Useful as part of the build process.

liquibase:updateSQL

Generates the SQL that is required to update the database to the current version as specified in the DatabaseChangeLogs.

liquibase:updateTestingRollback

Applies the DatabaseChangeLogs to the database, testing rollback. This is done by updating the database, rolling it back then updating it again.

Often used code snippets:

<plugin>
  <groupId>org.liquibase</groupId>
  <artifactId>liquibase-maven-plugin</artifactId>
  <version>${liquibase.version}</version>
  <configuration>
    <changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
    <diffChangeLogFile>src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
    <driver>org.h2.Driver</driver>
    <url>jdbc:h2:file:./target/h2db/db/jhipstersampleapplication</url>
    <defaultSchemaName/>
    <username>jhipsterSampleApplication</username>
    <password/>
    <referenceUrl>hibernate:spring:io.github.jhipster.application.domain?dialect=org.hibernate.dialect.H2Dialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
    <verbose>true</verbose>
    <logging>debug</logging>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.javassist</groupId>
      <artifactId>javassist</artifactId>
      <version>${javassist.version}</version>
    </dependency>
    <dependency>
      <groupId>org.liquibase.ext</groupId>
      <artifactId>liquibase-hibernate5</artifactId>
      <version>${liquibase-hibernate5.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-jpa</artifactId>
      <version>${spring-boot.version}</version>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>${validation-api.version}</version>
    </dependency>
  </dependencies>
</plugin>
<plugin>
  <groupId>org.liquibase</groupId>
  <artifactId>liquibase-maven-plugin</artifactId>
  <version>3.4.1</version>
  <executions>
    <execution>
      <id>build.sample.hsqldb</id>
      <phase>generate-test-resources</phase>
      <goals>
        <goal>update</goal>
      </goals>
      <configuration>
        <changeLogFile>${basedir}/src/test/resources/liquibase/changelog.xml</changeLogFile>
        <driver>org.hsqldb.jdbc.JDBCDriver</driver>
        <url>jdbc:hsqldb:file:${project.build.directory}/hsqldb/sample;shutdown=true</url>
        <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
        <logging>off</logging>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.liquibase</groupId>
  <artifactId>liquibase-maven-plugin</artifactId>
  <version>${liquibase.version}</version>
  <configuration>
    <changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
    <diffChangeLogFile>src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
    <driver>org.h2.Driver</driver>
    <url>jdbc:h2:file:./target/h2db/db/jhipstersampleapplication</url>
    <defaultSchemaName/>
    <username>jhipsterSampleApplication</username>
    <password/>
    <referenceUrl>hibernate:spring:io.github.jhipster.application.domain?dialect=org.hibernate.dialect.H2Dialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
    <verbose>true</verbose>
    <logging>debug</logging>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.javassist</groupId>
      <artifactId>javassist</artifactId>
      <version>${javassist.version}</version>
    </dependency>
    <dependency>
      <groupId>org.liquibase.ext</groupId>
      <artifactId>liquibase-hibernate5</artifactId>
      <version>${liquibase-hibernate5.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-jpa</artifactId>
      <version>${project.parent.version}</version>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>${validation-api.version}</version>
    </dependency>
  </dependencies>
</plugin>
<plugin>
  <groupId>org.liquibase</groupId>
  <artifactId>liquibase-maven-plugin</artifactId>
  <version>3.4.1</version>
  <configuration>
    <propertyFile>src/main/resources/liquibase.properties</propertyFile>
  </configuration>
</plugin>
<plugin>
  <groupId>org.liquibase</groupId>
  <artifactId>liquibase-maven-plugin</artifactId>
  <version>${liquibase.version}</version>
  <configuration>
    <changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
    <diffChangeLogFile>src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
    <driver>com.mysql.jdbc.Driver</driver>
    <url>jdbc:mysql://localhost:3306/jhipsterSampleApplication</url>
    <defaultSchemaName>jhipsterSampleApplication</defaultSchemaName>
    <username>root</username>
    <password/>
    <referenceUrl>hibernate:spring:io.github.jhipster.application.domain?dialect=org.hibernate.dialect.MySQL5InnoDBDialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
    <verbose>true</verbose>
    <logging>debug</logging>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.javassist</groupId>
      <artifactId>javassist</artifactId>
      <version>${javassist.version}</version>
    </dependency>
    <dependency>
      <groupId>org.liquibase.ext</groupId>
      <artifactId>liquibase-hibernate5</artifactId>
      <version>${liquibase-hibernate5.version}</version>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-data-jpa</artifactId>
      <version>${spring-boot.version}</version>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>${validation-api.version}</version>
    </dependency>
  </dependencies>
</plugin>

© Jiri Pinkas 2015 - 2022. All rights reserved! Admin login To submit bugs / feature requests please use this github page
related: JavaVids | Top Java Blogs | Java školení
Apache and Apache Maven are trademarks of the Apache Software Foundation. The Central Repository is a service mark of Sonatype, Inc.