Ant Tasks

Tasks

The following tasks are available in Ant:

Additional Liquibase commands are supported by the command line that are not supported by the Ant tasks.

Migrating From Legacy Tasks

Starting in Liquibase 3.3 the ant tasks were changed, moving all of the database attributes out of the task and into its own type. The deprecated attributes will now log a warning message instructing callers of the deprecation. While backward compatibility exists, it is advised that users migrate their ant builds to use the new tasks.

In order to use the new Liquibase tasks, the <taskdef> needs to be redefined to use the antlib.xml file:

<project  name="Example"  xmlns:liquibase="antlib:liquibase.integration.ant">  
	<taskdef  resource="liquibase/integration/ant/antlib.xml"  uri="antlib:liquibase.integration.ant">  
		<classpath  path="path/to/liquibase/libs"/>  
	</taskdef>  
</project>

Here is an example of a legacy update task:

<updateDatabase changeLogFile="${db.changelog.file}"
	driver="${db.driver}"
	url="${db.url}" 
	username="${db.username}"  
	password="${db.password}" 
	promptOnNonLocalDatabase="${prompt.user.if.not.local.database}"  
	dropFirst="false"  
	classpathref="classpath"/>

Here is what it looks like migrated to the new task structure:

<liquibase:updateDatabase changeLogFile="/path/to/changelog.xml"
		dropFirst="false"
		classpathref="classpath"
		promptOnNonLocalDatabase="${prompt.user.if.not.local.database}">
	<liquibase:database driver="${db.driver}"
		url="${db.url}"
		user="${db.user}"
		password="${db.password}"/>
</liquibase:updateDatabase>