Liquibase can be run via a servlet listener. This allows you to have your database be updated automatically whenever the site is deployed. Since Liquibase uses distributed locking, this method will work just fine even if you have a cluster of application servers.
To configure the servlet listener, simply add liquibase.jar to your WEB-INF/lib directory and the following to your web.xml file:
If using Liquibase 1.9.x
|liquibase.changelog||LIQUIBASE_CHANGELOG||Specifies the changelog file to run required|
|liquibase.datasource||LIQUIBASE_DATA_SOURCE||JNDI datasource to use for running Liquibase. Note that the LIQUIBASE_DATA_SOURCE can be different than the data source the rest of your web app uses if that data source does not have sufficient privileges to create/alter tables etc. required|
|liquibase.host.excludes||LIQUIBASE_HOST_EXCLUDES||Specify host names on which you do NO want Liquibase to run. Specifying this parameter allows you to deploy the same WAR/EAR to multiple machines in different environments and not have Liquibase run on all of them.|
|liquibase.host.includes||LIQUIBASE_HOST_INCLUDES||Specify the ONLY host names on which want Liquibase to run. Specifying this parameter allows you to deploy the same WAR/EAR to multiple machines in different environments and not have Liquibase run on all of them.|
|liquibase.onerror.fail||LIQUIBASE_FAIL_ON_ERROR||Specify if an exception is thrown by Liquibase if an error occurs. Setting the value to "true" (default) will cause the exception to be thrown and keep the site from initializing properly. Setting the value to "false" will allow the site to deploy as normal, but the database will be in an undefined state.|
|liquibase.contexts||LIQUIBASE_CONTEXTS||A comma separated lists of the Contexts to run in.|
If you want to control servers that run Liquibase but don't want to set the LIQUIBASE_HOST_EXCLUDES/LIQUIBASE_HOST_INCLUDES attributes, you can specify the “liquibase.should.run=[true/false]” system property.