maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Melvyn de Kort <>
Subject Re: Database generation in separate module
Date Tue, 05 Nov 2013 14:01:03 GMT
Hi List,

I haven't received an answer from the list, but I've found a solution
In the context of sharing knowledge, here is how I've solved my problem:

(again this "image" for clarification)

   |    |-pom.xml
   |    |-pom.xml
   |    |-pom.xml
   |    |-src/../liquibase.xml

The database module now also builds a zip assembly from the generated H2
database in the target directory (phase: package).
This assembly is installed into the local Maven repository.
In the other modules I've added (scope: test) dependencies to this zip
I use the maven-dependency-plugin to unpack the zip dependency into its
target directory (phase: generate-resources).
Now I can use the H2 database as a dependency, which was generated in
another module.

The only thing I don't really like about it, is that the generated
database, which is currently still small, is deployed in my Maven repo.
But on the other side, it does allow the other modules to always use it,
even without (re-)building the database module in each run.

Yay for Maven ;-)


On Thu, Oct 31, 2013 at 7:48 PM, Melvyn de Kort <> wrote:

> Hi all,
> I have a project which consists of several modules:
> pom.xml
>   |
>    --- module1
>   |       src/...
>   |       pom.xml
>   |
>    --- module2
>   |       src/...
>   |       pom.xml
>   |
>    --- database
>           src/.../liquibase.xml
>           pom.xml
> 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 of its own module (database/target/dbfile).
> 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 the target folder
> of the database module into the target directory of module 1 or/and 2? Or
> are there any other mechanisms I could use?
> I prefer not 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.
> Thank you in advance.
> Melvyn

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message