tags:

views:

13

answers:

0

We have a Maven project that contains a root pom, and several other modules/poms. The directory structure is as follow:

/
/pom.xml              // the root pom
/module1/
/module1/pom.xml
/module2/
/module2/pom.xml
...

In the root pom, we define and use a root.dir variable:

<properties>
    <root.dir>${basedir}/${parent.dir}</root.dir>
    <output.dir>${root.dir}/out</output.dir>
    <parent.dir>.</parent.dir>
</properties>

We also access root.dir from child poms. For this to work correctly, every child pom has to define:

<properties>
    <parent.dir>..</parent.dir>
</properties>

Is there a better alternative that doesn't force every child to define a property?