You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Babak Farhang <fa...@gmail.com> on 2010/10/26 20:42:48 UTC

avoiding parent pom version number duplication

Hi everyone,

I have a nested, multi-module project in which every module's pom
inherits from a root pom. I'd like to find a way to avoid duplicating
the parent pom version number in every submodule. The aim is to keep
the version number for these submodules in sync with one another, from
one release to the next. Here's a strategy I've tried using
profiles.xml that doesn't quite work.

profiles.xml:
==========

<profilesXml>
  <profiles>
    <profile>
      <id>projectProfile</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
         <!-- This is the property injection I'm having trouble with: -->
         <rootVersion>1.0.2</rootVersion>
      </properties>
    </profile>
  </profiles>
</profilesXml>


pom.xml (root):
============

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.myorg</groupId>
  <artifactId>root</artifactId>
  <name>Root</name>
  <version>${rootVersion}</version>
  <packaging>pom</packaging>
  <modules>
    <module>util</module>
  </modules>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <org.springframework.version>3.0.2.RELEASE</org.springframework.version>
    <servlet.api.version>2.5</servlet.api.version>
    <log4j.version>1.2.16</log4j.version>
    <junit.version>3.8.1</junit.version>
    <httpclient.version>3.1</httpclient.version>
    <dnsjava.version>2.0.6</dnsjava.version>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
          <encoding>UTF-8</encoding>
          <debug>true</debug>
          <showDeprecation>true</showDeprecation>
          <showWarnings>true</showWarnings>
          <compilerArgument>-Xlint</compilerArgument>
          <compilerArguments>
            <Xmaxerrs>10000000</Xmaxerrs>
            <Xmaxwarns>10000000</Xmaxwarns>
          </compilerArguments>
          <verbose/>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <forkMode>pertest</forkMode>
          <argLine>-Xms256m -Xmx1024m</argLine>
          <testFailureIgnore>false</testFailureIgnore>
          <skip>false</skip>
          <includes>
            <include>**/*Test.java</include>
          </includes>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>


util/pom.xml:
==========
<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.0
http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>root</artifactId>
    <groupId>com.myorg</groupId>
    <version>${rootVersion}</version>
  </parent>

  <artifactId>util</artifactId>
  <name>Common Utilities</name>
  <packaging>jar</packaging>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>${log4j.version}</version>
    </dependency>

  </dependencies>
</project>


================================

On mvn install'ing from the root directory of the project here's the
directory I get:

% tree ~/.m2/repository/com/myorg
myorg/
|-- root
|   |-- 1.0.2
|   |   `-- root-1.0.2.pom
|   `-- maven-metadata-local.xml
`-- util
    |-- ${rootVersion}
    |   |-- util-${rootVersion}.jar
    |   `-- util-${rootVersion}.pom
    `-- maven-metadata-local.xml

Note that ${rootVersion} was not transformed to 1.0.2.  Also, here's
what's inside the root pom file after it's been installed:

% cat ~/m2/repository/com/myorg/root/1.0.2/root-1.0.2.pom
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocatio
n="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.myorg</groupId>
  <artifactId>root</artifactId>
  <name>Root</name>
  <version>${rootVersion}</version>   <!-- why wasn't 1.0.2 injected here? -->
  <packaging>pom</packaging>
  <modules>
    <module>util</module>
  </modules>
  ..

And here's the directory structrure I was hoping to get:

myorg/
|-- root
|   |-- 1.0.2
|   |   `-- root-1.0.2.pom
|   `-- maven-metadata-local.xml
`-- util
    |-- 1.0.2
    |   |-- util-1.0.2.jar
    |   `-- util-1.0.2.pom
    `-- maven-metadata-local.xml





Any insights as to how I should approach this?

-Babak

PS This email is somewhat related to
http://www.mail-archive.com/users@maven.apache.org/msg113594.html
There, the concern is to avoid duplicating version numbers for
dependent artifacts: here the concern is to avoid duplicating the
version number of the parent POM.
Started this new thread in order to disambiguate these 2 related but
still separate issues.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: avoiding parent pom version number duplication

Posted by Babak Farhang <fa...@gmail.com>.
Just for the record, and for future folks searching this issue, the
versions plugin allows one to synchronize parent/child pom versions
like so:

1. Change the root pom's version
2. Incant: mvn -N versions:update-child-modules

So, yes, the version number is duplicated; but at least there's a
plugin to help you keep them synchronized.

See also: http://mojo.codehaus.org/versions-maven-plugin/update-child-modules-mojo.html

Cheers,
-Babak

On Tue, Oct 26, 2010 at 11:58 PM, Babak Farhang <fa...@gmail.com> wrote:
> Hi Arnaud,
>
> Thanks for the info. I'm playing with the versions plugin: hopefully
> that way I wont have to bring scm (release plugin) into the mix in
> order to address this issue.
>
> Babak
>
> 2010/10/26 Arnaud Héritier <ah...@gmail.com>:
>>>
>>> On Tue, Oct 26, 2010 at 21:00, Arnaud bourree <ar...@gmail.com>wrote:
>>>
>>>> 2010/10/26 Babak Farhang <fa...@gmail.com>:
>>>>> Hi everyone,
>>>>>
>>>>> I have a nested, multi-module project in which every module's pom
>>>>> inherits from a root pom. I'd like to find a way to avoid duplicating
>>>>> the parent pom version number in every submodule. The aim is to keep
>>>>> the version number for these submodules in sync with one another, from
>>>>> one release to the next. Here's a strategy I've tried using
>>>>> profiles.xml that doesn't quite work.
>>
>> It is impossible for now.
>> It is forbidden/not recommended to use properties in GAV (GroupId/ArtifactId/Version)
>> The minimum you can do now is to set the version in the parent pom and in each child in the parent section
>> For dependencies between modules you can use ${project.version}
>> In a near future (Maven 3.1 in theory) you won't have anymore to set the version in the parent element if your module defines the relative path to its parent or if it follows the convention to have it in its parent directory
>> To ensure to keep the same version everywhere you use the release plugin which will update them for you.
>> The versions plugin could help you too.
>>
>> Cheers
>>
>>
>> Arnaud
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: avoiding parent pom version number duplication

Posted by Babak Farhang <fa...@gmail.com>.
Hi Arnaud,

Thanks for the info. I'm playing with the versions plugin: hopefully
that way I wont have to bring scm (release plugin) into the mix in
order to address this issue.

Babak

2010/10/26 Arnaud Héritier <ah...@gmail.com>:
>>
>> On Tue, Oct 26, 2010 at 21:00, Arnaud bourree <ar...@gmail.com>wrote:
>>
>>> 2010/10/26 Babak Farhang <fa...@gmail.com>:
>>>> Hi everyone,
>>>>
>>>> I have a nested, multi-module project in which every module's pom
>>>> inherits from a root pom. I'd like to find a way to avoid duplicating
>>>> the parent pom version number in every submodule. The aim is to keep
>>>> the version number for these submodules in sync with one another, from
>>>> one release to the next. Here's a strategy I've tried using
>>>> profiles.xml that doesn't quite work.
>
> It is impossible for now.
> It is forbidden/not recommended to use properties in GAV (GroupId/ArtifactId/Version)
> The minimum you can do now is to set the version in the parent pom and in each child in the parent section
> For dependencies between modules you can use ${project.version}
> In a near future (Maven 3.1 in theory) you won't have anymore to set the version in the parent element if your module defines the relative path to its parent or if it follows the convention to have it in its parent directory
> To ensure to keep the same version everywhere you use the release plugin which will update them for you.
> The versions plugin could help you too.
>
> Cheers
>
>
> Arnaud
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: avoiding parent pom version number duplication

Posted by Arnaud Héritier <ah...@gmail.com>.
> 
> On Tue, Oct 26, 2010 at 21:00, Arnaud bourree <ar...@gmail.com>wrote:
> 
>> 2010/10/26 Babak Farhang <fa...@gmail.com>:
>>> Hi everyone,
>>> 
>>> I have a nested, multi-module project in which every module's pom
>>> inherits from a root pom. I'd like to find a way to avoid duplicating
>>> the parent pom version number in every submodule. The aim is to keep
>>> the version number for these submodules in sync with one another, from
>>> one release to the next. Here's a strategy I've tried using
>>> profiles.xml that doesn't quite work.

It is impossible for now.
It is forbidden/not recommended to use properties in GAV (GroupId/ArtifactId/Version)
The minimum you can do now is to set the version in the parent pom and in each child in the parent section
For dependencies between modules you can use ${project.version}
In a near future (Maven 3.1 in theory) you won't have anymore to set the version in the parent element if your module defines the relative path to its parent or if it follows the convention to have it in its parent directory
To ensure to keep the same version everywhere you use the release plugin which will update them for you.
The versions plugin could help you too.

Cheers


Arnaud
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: avoiding parent pom version number duplication

Posted by Anders Hammar <an...@hammar.net>.
Arnoud,

You don't need to set the project version if it's the same as the parent.
It's inherited from the parent.

/Anders

On Tue, Oct 26, 2010 at 21:00, Arnaud bourree <ar...@gmail.com>wrote:

> 2010/10/26 Babak Farhang <fa...@gmail.com>:
> > Hi everyone,
> >
> > I have a nested, multi-module project in which every module's pom
> > inherits from a root pom. I'd like to find a way to avoid duplicating
> > the parent pom version number in every submodule. The aim is to keep
> > the version number for these submodules in sync with one another, from
> > one release to the next. Here's a strategy I've tried using
> > profiles.xml that doesn't quite work.
> >
> > profiles.xml:
> > ==========
> >
> > <profilesXml>
> >  <profiles>
> >    <profile>
> >      <id>projectProfile</id>
> >      <activation>
> >        <activeByDefault>true</activeByDefault>
> >      </activation>
> >      <properties>
> >         <!-- This is the property injection I'm having trouble with: -->
> >         <rootVersion>1.0.2</rootVersion>
> >      </properties>
> >    </profile>
> >  </profiles>
> > </profilesXml>
> >
> >
> > pom.xml (root):
> > ============
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > http://maven.apache.org/maven-v4_0_0.xsd">
> >  <modelVersion>4.0.0</modelVersion>
> >  <groupId>com.myorg</groupId>
> >  <artifactId>root</artifactId>
> >  <name>Root</name>
> >  <version>${rootVersion}</version>
> >  <packaging>pom</packaging>
> >  <modules>
> >    <module>util</module>
> >  </modules>
> >  <properties>
> >    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> >
>  <org.springframework.version>3.0.2.RELEASE</org.springframework.version>
> >    <servlet.api.version>2.5</servlet.api.version>
> >    <log4j.version>1.2.16</log4j.version>
> >    <junit.version>3.8.1</junit.version>
> >    <httpclient.version>3.1</httpclient.version>
> >    <dnsjava.version>2.0.6</dnsjava.version>
> >  </properties>
> >
> >  <build>
> >    <plugins>
> >      <plugin>
> >        <groupId>org.apache.maven.plugins</groupId>
> >        <artifactId>maven-compiler-plugin</artifactId>
> >        <configuration>
> >          <source>1.6</source>
> >          <target>1.6</target>
> >          <encoding>UTF-8</encoding>
> >          <debug>true</debug>
> >          <showDeprecation>true</showDeprecation>
> >          <showWarnings>true</showWarnings>
> >          <compilerArgument>-Xlint</compilerArgument>
> >          <compilerArguments>
> >            <Xmaxerrs>10000000</Xmaxerrs>
> >            <Xmaxwarns>10000000</Xmaxwarns>
> >          </compilerArguments>
> >          <verbose/>
> >        </configuration>
> >      </plugin>
> >
> >      <plugin>
> >        <groupId>org.apache.maven.plugins</groupId>
> >        <artifactId>maven-surefire-plugin</artifactId>
> >        <configuration>
> >          <forkMode>pertest</forkMode>
> >          <argLine>-Xms256m -Xmx1024m</argLine>
> >          <testFailureIgnore>false</testFailureIgnore>
> >          <skip>false</skip>
> >          <includes>
> >            <include>**/*Test.java</include>
> >          </includes>
> >        </configuration>
> >      </plugin>
> >    </plugins>
> >  </build>
> > </project>
> >
> >
> > util/pom.xml:
> > ==========
> > <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.0
> > http://maven.apache.org/maven-v4_0_0.xsd">
> >  <modelVersion>4.0.0</modelVersion>
> >  <parent>
> >    <artifactId>root</artifactId>
> >    <groupId>com.myorg</groupId>
> >    <version>${rootVersion}</version>
> >  </parent>
> >
> >  <artifactId>util</artifactId>
> >  <name>Common Utilities</name>
> >  <packaging>jar</packaging>
> >  <dependencies>
> >    <dependency>
> >      <groupId>junit</groupId>
> >      <artifactId>junit</artifactId>
> >      <version>${junit.version}</version>
> >      <scope>test</scope>
> >    </dependency>
> >
> >    <dependency>
> >      <groupId>log4j</groupId>
> >      <artifactId>log4j</artifactId>
> >      <version>${log4j.version}</version>
> >    </dependency>
> >
> >  </dependencies>
> > </project>
> >
> >
> > ================================
> >
> > On mvn install'ing from the root directory of the project here's the
> > directory I get:
> >
> > % tree ~/.m2/repository/com/myorg
> > myorg/
> > |-- root
> > |   |-- 1.0.2
> > |   |   `-- root-1.0.2.pom
> > |   `-- maven-metadata-local.xml
> > `-- util
> >    |-- ${rootVersion}
> >    |   |-- util-${rootVersion}.jar
> >    |   `-- util-${rootVersion}.pom
> >    `-- maven-metadata-local.xml
> >
> > Note that ${rootVersion} was not transformed to 1.0.2.  Also, here's
> > what's inside the root pom file after it's been installed:
> >
> > % cat ~/m2/repository/com/myorg/root/1.0.2/root-1.0.2.pom
> > <?xml version="1.0" encoding="UTF-8"?>
> > <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocatio
> > n="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> >  <modelVersion>4.0.0</modelVersion>
> >  <groupId>com.myorg</groupId>
> >  <artifactId>root</artifactId>
> >  <name>Root</name>
> >  <version>${rootVersion}</version>   <!-- why wasn't 1.0.2 injected here?
> -->
> >  <packaging>pom</packaging>
> >  <modules>
> >    <module>util</module>
> >  </modules>
> >  ..
> >
> > And here's the directory structrure I was hoping to get:
> >
> > myorg/
> > |-- root
> > |   |-- 1.0.2
> > |   |   `-- root-1.0.2.pom
> > |   `-- maven-metadata-local.xml
> > `-- util
> >    |-- 1.0.2
> >    |   |-- util-1.0.2.jar
> >    |   `-- util-1.0.2.pom
> >    `-- maven-metadata-local.xml
> >
> >
> >
> >
> >
> > Any insights as to how I should approach this?
>
> How Maven can evaluate ${rootVersion}? It needs ${rootVersion} to load
> parent pom and then find ${rootVersion}
> So for parent version you cannot used property.
>
> What you can do is: set root version in parent definition like
> <version>1.0</version>
> And in pom version set it ${parent.version} like
> <version>${parent.version}</version>
> Then when update root version, you only need to change parent version
> of all your pom xpath: /project/parent/version
>
> Regards,
>
> Arnaud.
>
>
> >
> > -Babak
> >
> > PS This email is somewhat related to
> > http://www.mail-archive.com/users@maven.apache.org/msg113594.html
> > There, the concern is to avoid duplicating version numbers for
> > dependent artifacts: here the concern is to avoid duplicating the
> > version number of the parent POM.
> > Started this new thread in order to disambiguate these 2 related but
> > still separate issues.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: avoiding parent pom version number duplication

Posted by Arnaud bourree <ar...@gmail.com>.
2010/10/26 Babak Farhang <fa...@gmail.com>:
> Hi everyone,
>
> I have a nested, multi-module project in which every module's pom
> inherits from a root pom. I'd like to find a way to avoid duplicating
> the parent pom version number in every submodule. The aim is to keep
> the version number for these submodules in sync with one another, from
> one release to the next. Here's a strategy I've tried using
> profiles.xml that doesn't quite work.
>
> profiles.xml:
> ==========
>
> <profilesXml>
>  <profiles>
>    <profile>
>      <id>projectProfile</id>
>      <activation>
>        <activeByDefault>true</activeByDefault>
>      </activation>
>      <properties>
>         <!-- This is the property injection I'm having trouble with: -->
>         <rootVersion>1.0.2</rootVersion>
>      </properties>
>    </profile>
>  </profiles>
> </profilesXml>
>
>
> pom.xml (root):
> ============
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
>  <modelVersion>4.0.0</modelVersion>
>  <groupId>com.myorg</groupId>
>  <artifactId>root</artifactId>
>  <name>Root</name>
>  <version>${rootVersion}</version>
>  <packaging>pom</packaging>
>  <modules>
>    <module>util</module>
>  </modules>
>  <properties>
>    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>    <org.springframework.version>3.0.2.RELEASE</org.springframework.version>
>    <servlet.api.version>2.5</servlet.api.version>
>    <log4j.version>1.2.16</log4j.version>
>    <junit.version>3.8.1</junit.version>
>    <httpclient.version>3.1</httpclient.version>
>    <dnsjava.version>2.0.6</dnsjava.version>
>  </properties>
>
>  <build>
>    <plugins>
>      <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-compiler-plugin</artifactId>
>        <configuration>
>          <source>1.6</source>
>          <target>1.6</target>
>          <encoding>UTF-8</encoding>
>          <debug>true</debug>
>          <showDeprecation>true</showDeprecation>
>          <showWarnings>true</showWarnings>
>          <compilerArgument>-Xlint</compilerArgument>
>          <compilerArguments>
>            <Xmaxerrs>10000000</Xmaxerrs>
>            <Xmaxwarns>10000000</Xmaxwarns>
>          </compilerArguments>
>          <verbose/>
>        </configuration>
>      </plugin>
>
>      <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-surefire-plugin</artifactId>
>        <configuration>
>          <forkMode>pertest</forkMode>
>          <argLine>-Xms256m -Xmx1024m</argLine>
>          <testFailureIgnore>false</testFailureIgnore>
>          <skip>false</skip>
>          <includes>
>            <include>**/*Test.java</include>
>          </includes>
>        </configuration>
>      </plugin>
>    </plugins>
>  </build>
> </project>
>
>
> util/pom.xml:
> ==========
> <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.0
> http://maven.apache.org/maven-v4_0_0.xsd">
>  <modelVersion>4.0.0</modelVersion>
>  <parent>
>    <artifactId>root</artifactId>
>    <groupId>com.myorg</groupId>
>    <version>${rootVersion}</version>
>  </parent>
>
>  <artifactId>util</artifactId>
>  <name>Common Utilities</name>
>  <packaging>jar</packaging>
>  <dependencies>
>    <dependency>
>      <groupId>junit</groupId>
>      <artifactId>junit</artifactId>
>      <version>${junit.version}</version>
>      <scope>test</scope>
>    </dependency>
>
>    <dependency>
>      <groupId>log4j</groupId>
>      <artifactId>log4j</artifactId>
>      <version>${log4j.version}</version>
>    </dependency>
>
>  </dependencies>
> </project>
>
>
> ================================
>
> On mvn install'ing from the root directory of the project here's the
> directory I get:
>
> % tree ~/.m2/repository/com/myorg
> myorg/
> |-- root
> |   |-- 1.0.2
> |   |   `-- root-1.0.2.pom
> |   `-- maven-metadata-local.xml
> `-- util
>    |-- ${rootVersion}
>    |   |-- util-${rootVersion}.jar
>    |   `-- util-${rootVersion}.pom
>    `-- maven-metadata-local.xml
>
> Note that ${rootVersion} was not transformed to 1.0.2.  Also, here's
> what's inside the root pom file after it's been installed:
>
> % cat ~/m2/repository/com/myorg/root/1.0.2/root-1.0.2.pom
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocatio
> n="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>  <modelVersion>4.0.0</modelVersion>
>  <groupId>com.myorg</groupId>
>  <artifactId>root</artifactId>
>  <name>Root</name>
>  <version>${rootVersion}</version>   <!-- why wasn't 1.0.2 injected here? -->
>  <packaging>pom</packaging>
>  <modules>
>    <module>util</module>
>  </modules>
>  ..
>
> And here's the directory structrure I was hoping to get:
>
> myorg/
> |-- root
> |   |-- 1.0.2
> |   |   `-- root-1.0.2.pom
> |   `-- maven-metadata-local.xml
> `-- util
>    |-- 1.0.2
>    |   |-- util-1.0.2.jar
>    |   `-- util-1.0.2.pom
>    `-- maven-metadata-local.xml
>
>
>
>
>
> Any insights as to how I should approach this?

How Maven can evaluate ${rootVersion}? It needs ${rootVersion} to load
parent pom and then find ${rootVersion}
So for parent version you cannot used property.

What you can do is: set root version in parent definition like
<version>1.0</version>
And in pom version set it ${parent.version} like
<version>${parent.version}</version>
Then when update root version, you only need to change parent version
of all your pom xpath: /project/parent/version

Regards,

Arnaud.


>
> -Babak
>
> PS This email is somewhat related to
> http://www.mail-archive.com/users@maven.apache.org/msg113594.html
> There, the concern is to avoid duplicating version numbers for
> dependent artifacts: here the concern is to avoid duplicating the
> version number of the parent POM.
> Started this new thread in order to disambiguate these 2 related but
> still separate issues.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org