My team has been using the versions plugin (specifically versions:set) for
doing releases and it has worked very well for us so far. I'm trying to
sort out an edge case that is causing us some problems.
We have a few a few multi-module projects where one or more of the child
projects has a different parent than the top level pom.

For example a top level pom like this:

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0http://maven.apache.org/maven-v4_0_0.xsd";>

    <groupId>com.example</groupId>

    <artifactId>top-level</artifactId>

    <version>0.0.1-SNAPSHOT</version>

    <packaging>pom</packaging>


    <modules>

        <module>example-core</module>

        <module>example-db</module>

        <module>example-tools</module>

    </modules>

</project>


Then the parent in example-core, and example-db both point back to the top
level pom as their parent. However, the example-tools project points at
another parent pom outside of this project. The other parent has plugins,
properties, dependencies ect that are to be shared by implementations of
this type of library in different projects. It saves the overhead of having
a separate repo for just this one project to set it up this way.

Now when we run mvn versions:set, the new version is applied correctly to
all but the poms where the parent pom isn't a direct descendant of the pom
from where we invoked versions:set. A workaround we have employed is to
invoke versions:set n times, once at the top level then once for every
child module that does not have the top level pom as its parent. This makes
for a brittle, error prone release process. We would like to be able to run
versions:set once from the top level and have it change all the child
modules with the same version as the top level pom regardless of the parent
that the child module points at. I couldn't find an option in the goal that
would accomplish this. So I did some looking into the source code and it
didn't seem too hard to add such a flag as an option in the versions:set
goal. I've attached a patch that adds such a flag to the SetMojo class.

Is there an already existing way to do this that I'm missing? If not does
this patch seem like a reasonable approach?


Thanks for your help in advance,


Chris Phillips

Attachment: strictParentHierarchy_flag.patch
Description: Binary data

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to