Skip to content

Instantly share code, notes, and snippets.

@wumpz
Created January 4, 2018 13:56
Show Gist options
  • Save wumpz/03998be02b3eecfc6797246db5739f11 to your computer and use it in GitHub Desktop.
Save wumpz/03998be02b3eecfc6797246db5739f11 to your computer and use it in GitHub Desktop.
maven plugin config to extract data using liquibase and maven (generateChangeLog) (structure and data)
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>test-data-liquibase</id>
<configuration>
<target xmlns:liquibase="antlib:liquibase.integration.ant">
<macrodef name="extract-data">
<attribute name="output" />
<attribute name="objectlist" />
<sequential>
<delete file="target/@{output}_struct.xml" />
<delete file="target/@{output}_data.xml" />
<java classname="liquibase.integration.commandline.Main" failonerror="true">
<arg line="--changeLogFile=target/@{output}_struct.xml --username=username --password=pwd --driver=org.postgresql.Driver --url=jdbc:postgresql://localhost:5432/testdb generateChangeLog --includeObjects=@{objectlist}" />
</java>
<java classname="liquibase.integration.commandline.Main" failonerror="true">
<arg line="--changeLogFile=target/@{output}_data.xml --username=username --password=pwd --driver=org.postgresql.Driver --url=jdbc:postgresql://localhost:5432/testdb --diffTypes=data generateChangeLog --includeObjects=@{objectlist}" />
</java>
</sequential>
</macrodef>
<extract-data output="mychangelog" objectlist="table1,table2,table3" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.5.3</version>
</dependency>
</dependencies>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment