Liquibase Ant Implementation
├─ build.xml ├─ ivysettings.xml ├─ ivy.xml └─ ant ├─ build.js └─ build.properties |
SELECT
id, author, filename, dateexecuted, orderexecuted,
exectype, md5sum, description, comments, tag,
liquibase, contexts, labels, deployment_id
FROM
databasechangelog;
|
SELECT
id, locked,
lockgranted,
lockedby
FROM
databasechangeloglock;
|
Settings
ivysettings.xml
<ivysettings>
<settings defaultResolver="chorke.chain"/>
<caches defaultCacheDir="${basedir}/.ivy2/cache"/>
<credentials host="mvn.chorke.org" realm="Authorization" username="maven" passwd="chorke"/>
<resolvers>
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="chorke.public" root="http://mvn.chorke.org/m2/public" m2compatible="true"/>
<ibiblio name="chorke.releases" root="http://mvn.chorke.org/m2/releases" m2compatible="true"/>
<chain name="chorke.chain">
<resolver ref="central"/>
<resolver ref="chorke.public"/>
<resolver ref="chorke.releases"/>
</chain>
</resolvers>
<modules>
<module organisation="com.oracle.jdbc" resolver="chorke.public"/>
</modules>
</ivysettings>
Ivy
ivy.xml
<ivy-module version="2.0">
<info organisation="org.chorke.make" module="chorke-make-migrat" status="integration"/>
<configurations>
<conf name="compile" description="compile time dependencies"/>
<conf name="runtime" description="run-time dependencies" extends="compile"/>
<conf name="test" description="unit testing dependencies" extends="runtime"/>
<conf name="build" description="ant dependencies"/>
</configurations>
<dependencies>
<dependency org="org.liquibase" name="liquibase-core" rev="3.5.3" conf="build->default"/>
<dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" conf="build->default">
<exclude org="ant" module="ant"/>
</dependency>
<dependency org="org.yaml" name="snakeyaml" rev="1.14" conf="build->default"/>
<!-- vendor specific jdbc driver to perform liquibase migration -->
<dependency org="com.microsoft.sqlserver" name="mssql-jdbc" rev="6.2.2.jre7" conf="build->default"/>
<dependency org="org.apache.derby" name="derbyclient" rev="10.10.2.0" conf="build->default"/>
<dependency org="postgresql" name="postgresql" rev="9.0-801.jdbc4" conf="build->default"/>
<dependency org="mysql" name="mysql-connector-java" rev="5.1.21" conf="compile->default"/>
<dependency org="org.apache.derby" name="derby" rev="10.10.2.0" conf="build->default"/>
<dependency org="com.oracle.jdbc" name="ojdbc6" rev="11.2.0.4" conf="build->default">
<exclude org="com.oracle.jdbc" module="xmlparserv2"/>
<exclude org="com.oracle.jdbc" module="oraclepki"/>
<exclude org="com.oracle.jdbc" module="osdt_cert"/>
<exclude org="com.oracle.jdbc" module="osdt_core"/>
<exclude org="com.oracle.jdbc" module="orai18n"/>
<exclude org="com.oracle.jdbc" module="xdb6"/>
</dependency>
<dependency org="com.h2database" name="h2" rev="1.4.190" conf="build->default"/>
<dependency org="org.hsqldb" name="hsqldb" rev="2.3.3" conf="build->default"/>
</dependencies>
</ivy-module>
Ant Build
build.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="chorke" default="cki.ini" basedir="."
xmlns:liq="antlib:liquibase.integration.ant"
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:con="antlib:net.sf.antcontrib">
<description>chorke ant ivy impl</description>
<property name="ant.dir" location="${basedir}/ant"/>
<property name="ant.lib" location="${user.home}/.ant/lib"/>
<property name="chorke.home" location="${user.home}/.chorke"/>
<available file="${ant.lib}/ivy.jar" property="ivy.jar.exist"/>
<property name="academia.home" location="${chorke.home}/academia"/>
<property name="sonatype.local" value="https://repository.sonatype.org/service/local"/>
<property name="central.proxy" value="${sonatype.local}/artifact/maven/redirect?r=central-proxy"/>
<property name="dev.mysql.params" value="autoReconnect=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull"/>
<property name="dev.mysql.url" value="jdbc:mysql://db.chorke.org:3306/chorke_init_pro?${dev.mysql.params}"/>
<property name="liquibase.diffTypes" value="tables,views,columns,indexes,foreignkeys,primarykeys,uniqueconstraints"/>
<property name="liquibase.changeSetAuthor" value="Chorke Academia, Inc"/>
<property name="liquibase.changeSetContext" value="dev,qac,uat,pro"/>
<property name="liquibase.contexts" value="dev"/>
<!-- <path id="driver.classpath">
<filelist files="${basedir}/lib/runtime" />
</path> -->
<target name="cki.log">
<script language="javascript" src="${ant.dir}/build.js">
Chorke.ant.init(true);
</script>
</target>
<target name="cki.get" depends="cki.log" unless="ivy.jar.exist">
<mkdir dir="${ant.lib}"/>
<get src="${central.proxy}&g=org.apache.ivy&a=ivy&v=2.3.0&e=jar" dest="${ant.lib}/ivy.jar"/>
</target>
<target name="cki.ivy" depends="cki.get" if="ivy.jar.exist">
<ivy:resolve/>
<ivy:report todir="${basedir}/target/ivy-reports" graph="false" xml="false"/>
<ivy:cachepath pathid="compile.path" conf="compile"/>
<ivy:cachepath pathid="runtime.path" conf="runtime"/>
<ivy:cachepath pathid="build.path" conf="build"/>
<ivy:cachepath pathid="test.path" conf="test"/>
<ivy:retrieve sync="false" conf="compile" pattern="lib/[conf]/[artifact](-[classifier]).[ext]"/>
<ivy:retrieve sync="false" conf="runtime" pattern="lib/[conf]/[artifact](-[classifier]).[ext]"/>
<ivy:retrieve sync="false" conf="build" pattern="lib/[conf]/[artifact](-[classifier]).[ext]"/>
<ivy:retrieve sync="false" conf="test" pattern="lib/[conf]/[artifact](-[classifier]).[ext]"/>
</target>
<target name="cki.def" depends="cki.ivy" if="ivy.jar.exist">
<taskdef resource="net/sf/antcontrib/antlib.xml" uri="antlib:net.sf.antcontrib" classpathref="build.path"/>
<taskdef resource="liquibase/integration/ant/antlib.xml" uri="antlib:liquibase.integration.ant" classpathref="build.path"/>
</target>
<target name="cki.dep" if="ivy.jar.exist">
<path id="driver.classpath">
<filelist dir="${basedir}/lib/build">
<file name="liquibase-core.jar" />
</filelist>
<filelist dir="${basedir}/lib/runtime">
<file name="mysql-connector-java.jar" />
</filelist>
</path>
<liq:generateChangeLog classpathref="driver.classpath">
<liq:database driver="com.mysql.jdbc.Driver" url="${dev.mysql.url}" user="chorke_init_pro" password="chorke_init_pro"/>
<liq:xml outputfile="${basedir}/target/changelog.xml" encoding="UTF-8"/>
<liq:changeLogParameters>
<liq:changeLogParameter name="diffTypes" value="tables,views,columns,indexes,foreignkeys,primarykeys,uniqueconstraints,data"/>
<liq:changeLogParameter name="changeSetContext" value="dev,qac,uat,pro"/>
<liq:changeLogParameter name="dataDir" value="${basedir}/target"/>
<liq:changeLogParameter name="changeSetAuthor" value="chorke"/>
<liq:changeLogParameter name="contexts" value="dev"/>
<propertyset>
<propertyref prefix="params"/>
</propertyset>
</liq:changeLogParameters>
</liq:generateChangeLog>
</target>
<target name="cki.ini" depends="cki.def">
<sequential>
<antcall target="cki.dep"/>
</sequential>
</target>
</project>