For our projects, we created ant tasks for this. For example, if you want to migrate, the ant file might look like this:
ant-migrations.xml
<project name="Migrations" basedir="." default="update-database"> <property file="./liquibasetasks.properties" /> <path id="master-classpath" description="Master classpath"> <fileset dir="..\lib"> <include name="*.jar" /> </fileset> </path> <target name="update-database"> <fail unless="db.changelog.file">db.changelog.file not set</fail> <fail unless="database.url">database.url not set</fail> <fail unless="database.username">database.username not set</fail> <fail unless="database.password">database.password not set</fail> <taskdef resource="liquibasetasks.properties"> <classpath refid="master-classpath"/> </taskdef> <updateDatabase changeLogFile="${db.changelog.file}" driver="${database.driver}" url="${database.url}" username="${database.username}" password="${database.password}" promptOnNonLocalDatabase="${prompt.user.if.not.local.database}" dropFirst="false" classpathref="master-classpath" /> </target></project>
Make sure your liquibase file is listed in the classpath element.
The properties file contains links that are relevant to your environment:
liquibasetasks.properties
db.changelog.file=YOUR_MIGRATION_FILE.xml database.driver= database.username= database.password= database.url=
So, now we have installed and configured the ant .. task with everything saved, you should be able to start the migration by entering the following at the command line:
linux>ant -f ant-migrations.xml update-database
Hope this helps!
awied source share