If this com.dummy:parent is a separate project and you are inheriting it in 
more than one project to get help for dependency management, properties and 
other common feature like distributionManagement...etc. The best solution is

Child pom:
    <parent>
        <groupId>com.dummy</groupId>
        <artifactId>parent</artifactId>
        <version>RELEASE</version>
    </parent>

    <groupId>com.dummy</groupId>
    <artifactId>kid</artifactId>


When you run build, it will try to find latest release version of parent from 
maven repository by parsing metadata.

<version>LATEST</version> can also be used in case latest version(either 
SNAPSHOT or release version) in maven repo.


Thanks
Pawan

-----Original Message-----
From: Billy Newman [mailto:newman...@gmail.com] 
Sent: Friday, August 17, 2012 11:57 AM
To: Maven Users List
Subject: Inherit parent version?

In Maven 2.

I have a multi-module hierarchy and I would like the parent to be the only 
place that the version is defined.  However I do not think this is possible in 
maven 2.  If it is possible please let me know what I am doing wrong.

Parent pom:

<groupId>com.dummy</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<packaging>pom</packaging>

Child pom:
    <parent>
        <groupId>com.dummy</groupId>
        <artifactId>parent</artifactId>
<!--
        <version>1.0</version>
-->
    </parent>

    <groupId>com.dummy</groupId>
    <artifactId>kid</artifactId>


Above example will not work as I have to set the version of my parent.
 From what I have read I do not think that this is possible in maven 2, but I 
could have missed something.

I think I can work around this by setting a property in the parent.  I am 
definitely all ears if there is a better way to accomplish this.

Parent:

<groupId>com.dummy<groupId>
<artifactId>parent</artifactId>
<version>${myversion}</version>
<packaging>pom</packaging>

<properties>
  <myversion>1.0</myversion>
</properties>

Child pom:
    <parent>
        <groupId>com.dummy</groupId>
        <artifactId>parent</artifactId>
        <version>${myversion}/version>
    </parent>

    <groupId>com.dummy<groupId>
    <artifactId>kid</artifactId>


Thanks again for the help.

Billy

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

This message, including any attachments, is intended only for the recipient(s) 
named above. It may contain confidential and privileged information. If you 
have received this communication in error, please notify the sender immediately 
and destroy or delete the original message. Also, please be aware that if you 
are not the intended recipient, any review, disclosure, copying, distribution 
or any action or reliance based on this message is prohibited by law.

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

Reply via email to