Ant Tasks
Tasks
The following tasks are available in Ant:
- Ant changeLogSync
- Ant changeLogSyncToTag
- Ant changeLogSyncToTagSql
- Ant dbDoc
- Ant diffDatabase
- Ant diffDatabaseToChangeLog
- Ant dropAllDatabaseObjects
- Ant generateChangeLog
- Ant markNextChangesetRan
- Ant rollbackDatabase
- Ant rollbackFutureDatabase
- Ant tagDatabase
- Ant updateDatabase
Additional Liquibase commands are supported by the command line that are not supported by the Ant tasks.
Migrating From Legacy Tasks
Starting with 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.
To use the new Liquibase tasks, redefine the <taskdef>
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>