Liquibase changelog in it's own Maven Module

Hi all,

I have a project which consists of several modules:

   — module1
  |       src/…
  |       pom.xml
   — module2
  |       src/…
  |       pom.xml
   — database

My Liquibase changelogs are all in the database module under the src/main/resources directory.
The database module executes the liquibase:update during the process-resources stage, this works great.
During a normal run It uses a H2 database which it creates in the target directory.
The packaging of this module is simply pom, and I plan on configuring an assembly which creates a ZIP file containing everything needed for setting up and updating a database.

Now my problem is that when I want to test one of my other modules against a database, I want to use a H2 database which was created by Liquibase.
How can I get the Liquibase generated H2 database from module A into the target directory of module B? Or are there any other mechanisms I could use?

I don’t want to generate the H2 database in something else than the target directories when I don’t have to.
I want the Maven projects to be self-contained and not rely on some other directory or the users settings.xml.

This is more of a general maven question than a Liquibase question, correct? You have files (your h2 database files) in a module’s target and you want to be able to share those files across other modules?

I tend to not do a lot of Maven config work so I don’t know of a solution for you, sorry.


Hi Nathan,

It probably is more of a general Maven question, but I was hoping some other Liquibase users had faced the same problem as I do.
This is why I posted this question here.
I still hope someone can give me some hints before I ask it in some Maven forum.