How to Run a Liquibase Job as a Maven Build
When liquibase is integrated into a maven project we can take advantage of the liquibase maven plugin to create a maven build for us. This w...
When liquibase is integrated into a maven project we can take advantage of the liquibase maven plugin to create a maven build for us. This will run the changesets over a database.
1. Liquibase Plugin
First, we need to add the liquibase plugin to our maven project.
<plugin> <groupId>org.liquibase</groupId> <artifactId>liquibase-maven-plugin</artifactId> <version>3.5.3</version> <configuration> <changeLogFile>${liquibase.changeLogFile}</changeLogFile> <driver>${db.driver}</driver> <url>${db.url}</url> <defaultSchemaName>${db.schema}</defaultSchemaName> <username>${db.username}</username> <password>${db.password}</password> <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase> <expressionVariables> <db.schema>${db.schema}</db.schema> </expressionVariables> </configuration> </plugin>Take note of the variables.
2. Create a Build Configuration
<profile> <id>rebuild</id> <properties> <liquibase.changeLogFile>src/main/db_resources/changelog/db.rebuild.xml</liquibase.changeLogFile> </properties> </profile>
Post a Comment