You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jeffrey N Hagelberg <jn...@us.ibm.com> on 2009/04/29 21:53:23 UTC

Version Number Inheritance

Hi,

We're trying to define a project structure where the version is defined in 
the top level project and inherited by all of the sub-projects.  This type 
of structure would make it so that we only have to define the version 
number in one place and allow us to maintain one maven repository with all 
of the versions of our project in it.  I've attached what we have right 
now.  What we've basically done is defined a variable in the top level 
pom.xml called "mmi.version" and then referenced that everywhere we need a 
version.  This has worked up to a point.  The problem I'm seeing occurs 
when it is trying to obtain the plugin "mmi-xmeta-installer-plugin" from 
the local maven repository.  It succeeds in obtaining the plugin itself 
from the local maven repository.  However, when it tries to get the 
artifacts for the parent project (mmi_plugins), it dies with the following 
error:

Cannot find parent: com.ibm.mmi:mmi_plugins for project: 
null:mmi-xmeta-installer-plugin:maven-plugin:null for project 
null:mmi-xmeta-installer-plugin:maven-plugin:null

I guess my first question is whether anyone has been able to to 
successfully get a child project to inherit the version of its parent 
project and if so, how they made it work.  What we have defined is a 
little wierd, since we're attempting to use a variable defined in the 
parent pom.xml to resolve the parent itself.  That may be the root cause 
of this error.  However, it's the best we have been able to do so far.  We 
do not want to have to duplicate the version in all of our pom.xmls.

Thanks for any help you can provide.

-Jeff



Jeffrey Hagelberg, Software Engineer
XMeta Development
IBM Software Group
Phone: 978-899-2055 T/L:276-2055)
Email:jnhagelb@us.ibm.com

Re: Version Number Inheritance

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Apr 29, 2009 at 12:53 PM, Jeffrey N Hagelberg
<jn...@us.ibm.com> wrote:

> I guess my first question is whether anyone has been able to to successfully
> get a child project to inherit the version of its parent project and if so,
> how they made it work.  What we have defined is a little wierd, since we're
> attempting to use a variable defined in the parent pom.xml to resolve the
> parent itself.  That may be the root cause of this error.  However, it's the
> best we have been able to do so far.  We do not want to have to duplicate
> the version in all of our pom.xmls.

You can't use a property for the parent version.  It has to be
specified, and yes, duplicated, however the release plugin will update
all the versions for you.  Also take a look at the 'versions' plugin
which has some goals to help update the versions.

If you search the dev list and JIRA you'll find a long discussion
about 'auto parent versioning' which I believe is what you want here,
but it's difficult to get right and hasn't been implemented.

-- 
Wendy

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


Re: Version Number Inheritance

Posted by Grant Rettke <gr...@acm.org>.
On Wed, Apr 29, 2009 at 9:48 PM, Wendy Smoak <ws...@gmail.com> wrote:
> On Wed, Apr 29, 2009 at 7:39 PM, Grant Rettke <gr...@acm.org> wrote:
>> On Wed, Apr 29, 2009 at 2:58 PM, Nick Stolwijk <ni...@gmail.com> wrote:
>>> Just put the version number in the parent and have the child poms
>>> refer to the version.
>>
>> When you omit the version in a child module, it inherits that of the
>> parent, right?
>
> Yes, but you still have to specify the version of the parent, which is
> what the OP objects to.
>
> The parent has:
> <project>
>   <version>2.3-SNAPSHOT</version>
>
> and the child has:
> <project>
>  <parent>
>     <version>2.3-SNAPSHOT</version>

Understood. Thanks.

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


Re: Version Number Inheritance

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Apr 29, 2009 at 7:39 PM, Grant Rettke <gr...@acm.org> wrote:
> On Wed, Apr 29, 2009 at 2:58 PM, Nick Stolwijk <ni...@gmail.com> wrote:
>> Just put the version number in the parent and have the child poms
>> refer to the version.
>
> When you omit the version in a child module, it inherits that of the
> parent, right?

Yes, but you still have to specify the version of the parent, which is
what the OP objects to.

The parent has:
<project>
   <version>2.3-SNAPSHOT</version>

and the child has:
<project>
  <parent>
     <version>2.3-SNAPSHOT</version>

-- 
Wendy

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


Re: Version Number Inheritance

Posted by Grant Rettke <gr...@acm.org>.
On Wed, Apr 29, 2009 at 2:58 PM, Nick Stolwijk <ni...@gmail.com> wrote:
> Just put the version number in the parent and have the child poms
> refer to the version.

When you omit the version in a child module, it inherits that of the
parent, right?

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


Re: Version Number Inheritance

Posted by Nick Stolwijk <ni...@gmail.com>.
Just put the version number in the parent and have the child poms
refer to the version. Then always use the release plugin to update the
version. There is a circular dependency when you try to lookup a
parent by its version number when the version number is declared in
the parent.

Hth,

Nick Stolwijk
~Java Developer~

Iprofs BV.
Claus Sluterweg 125
2012 WS Haarlem
www.iprofs.nl



On Wed, Apr 29, 2009 at 9:53 PM, Jeffrey N Hagelberg
<jn...@us.ibm.com> wrote:
>
> Hi,
>
> We're trying to define a project structure where the version is defined in
> the top level project and inherited by all of the sub-projects.  This type
> of structure would make it so that we only have to define the version number
> in one place and allow us to maintain one maven repository with all of the
> versions of our project in it.  I've attached what we have right now.  What
> we've basically done is defined a variable in the top level pom.xml called
> "mmi.version" and then referenced that everywhere we need a version.  This
> has worked up to a point.  The problem I'm seeing occurs when it is trying
> to obtain the plugin "mmi-xmeta-installer-plugin" from the local maven
> repository.  It succeeds in obtaining the plugin itself from the local maven
> repository.  However, when it tries to get the artifacts for the parent
> project (mmi_plugins), it dies with the following error:
>
> Cannot find parent: com.ibm.mmi:mmi_plugins for project:
> null:mmi-xmeta-installer-plugin:maven-plugin:null for project
> null:mmi-xmeta-installer-plugin:maven-plugin:null
>
> I guess my first question is whether anyone has been able to to successfully
> get a child project to inherit the version of its parent project and if so,
> how they made it work.  What we have defined is a little wierd, since we're
> attempting to use a variable defined in the parent pom.xml to resolve the
> parent itself.  That may be the root cause of this error.  However, it's the
> best we have been able to do so far.  We do not want to have to duplicate
> the version in all of our pom.xmls.
>
> Thanks for any help you can provide.
>
> -Jeff
>
>
>
> Jeffrey Hagelberg, Software Engineer
> XMeta Development
> IBM Software Group
> Phone: 978-899-2055 T/L:276-2055)
> Email:jnhagelb@us.ibm.com
>
> ---------------------------------------------------------------------
> 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