Custom teardown - rebuild Liquibase state afterwards (can't re-run - Maven plugin)

I’m driving Liquibase with the Maven plugin. In an integration-test module I want to teardown the existing schema and rebuild it.  I can’t use the Liquibase teardown task as we have chains of reference-partitioned tables, (i.e. there is a correct order in which to drop the tables).

I have a simple drop-objects SQL changeset, and at the end of it it truncates DATABASECHANGELOG.

Within my Maven goal I’d like to drop the schema and recreate it.  Maven will only call Liquibase once.  I call a special changelog which runs my delete task then includes the master changeset.  But after I’ve purged DATABASECHANGELOG the state is stale, so many changes are skipped.

Is there a way to customise the teardown task, with your own SQL?  Or a task to instruct Liquibase to re-initialise its state from DATABASECHANGELOG?  Otherwise I think I need to invoke Maven twice (once to teardown, once to rebuild), which is not the way Maven projects should work.

- thanks, Barney

I’m not enough of a maven user to know what would need to be done to allow that. It looks like the Liquibase object that does the work is created in the execute() method of the Mojo so it would be fresh for each execution, but apparently that isn’t the case.


Does anyone who has done more Maven dev know what the problem is?

Nathan