You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Billy Newman <ne...@gmail.com> on 2012/08/17 17:56:41 UTC

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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Inherit parent version?

Posted by Anders Hammar <an...@hammar.net>.
That in progress state was added in 2008. I wouldn't put too much value in it.

But a patch would most likely speed things up. ;-)

/Anders

On Sat, Aug 18, 2012 at 3:27 PM, Billy Newman <ne...@gmail.com> wrote:
> Ok agreed its not a bug, but is an improvement:
>
> http://jira.codehaus.org/browse/MNG-624.
>
> Because this ticket is open and in progress I can only assume that
> some solution will be coming to version 3.1.
>
> On Sat, Aug 18, 2012 at 6:51 AM, Martin Eisengardt
> <ma...@gmail.com> wrote:
>> Yes. You need it. And this is not a bug so there is nothing to fix.
>>
>>
>> On Sat, Aug 18, 2012 at 2:41 PM, Billy Newman <ne...@gmail.com> wrote:
>>
>>> No, by fixed I mean do you need to include the version in the parent tag?
>>>
>>> Sent from my iPhone
>>>
>>>
>
> ---------------------------------------------------------------------
> 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: Inherit parent version?

Posted by Billy Newman <ne...@gmail.com>.
Ok agreed its not a bug, but is an improvement:

http://jira.codehaus.org/browse/MNG-624.

Because this ticket is open and in progress I can only assume that
some solution will be coming to version 3.1.

On Sat, Aug 18, 2012 at 6:51 AM, Martin Eisengardt
<ma...@gmail.com> wrote:
> Yes. You need it. And this is not a bug so there is nothing to fix.
>
>
> On Sat, Aug 18, 2012 at 2:41 PM, Billy Newman <ne...@gmail.com> wrote:
>
>> No, by fixed I mean do you need to include the version in the parent tag?
>>
>> Sent from my iPhone
>>
>>

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


Re: Inherit parent version?

Posted by Martin Eisengardt <ma...@gmail.com>.
Yes. You need it. And this is not a bug so there is nothing to fix.


On Sat, Aug 18, 2012 at 2:41 PM, Billy Newman <ne...@gmail.com> wrote:

> No, by fixed I mean do you need to include the version in the parent tag?
>
> Sent from my iPhone
>
>

Re: Inherit parent version?

Posted by Billy Newman <ne...@gmail.com>.
No, by fixed I mean do you need to include the version in the parent tag?

Sent from my iPhone

On Aug 18, 2012, at 2:48 AM, Stephen Connolly <st...@gmail.com> wrote:

> If by 'fixed' you mean RELEASE and LATEST no longer update, yes that
> functionality is gone in 3.0 IIRC
> 
> On Saturday, 18 August 2012, Billy Newman wrote:
> 
>> Out of curiosity is this 'fixed' in maven 3?
>> 
>> Thanks
>> 
>> Sent from my iPhone
>> 
>> On Aug 17, 2012, at 2:06 PM, "Gandhi, Pawan" <Gandhi.Pawan@pennmutual.com<javascript:;>>
>> wrote:
>> 
>>> Not bad in all cases. Can be bad in dependency resolution which no
>> longer used in parent pom in my case.
>>> 
>>> In my case, parent-pom is what provides me a centralized maven config
>> helpful for build server to control all plugins, profiles, site related
>> stuff, distributionManagement.
>>> 
>>> 
>>> 
>>> Thanks
>>> Pawan
>>> 
>>> -----Original Message-----
>>> From: Martin Eisengardt [mailto:martin.eisengardt@gmail.com<javascript:;>
>> ]
>>> Sent: Friday, August 17, 2012 1:15 PM
>>> To: Maven Users List
>>> Subject: Re: Inherit parent version?
>>> 
>>> IMHO this solution is very bad because of one reason: It influences
>> already released versions. IMHO mavens "deploy" goal does not put the
>> correct resolved version into the parent tag. Thus all versions you ever
>> deploy will resolut in corrupt poms because they lead to newer parent poms
>> as soon as there is a new release an thus receive a newer version name on
>> themselves.
>>> 
>>> following scenario:
>>> Parent V1.0.0 --> Child V1.0.0 resolves to parent 1.0.0 and uses version
>> 1.0.0 for itself Parent V1.0.1 --> Child V1.0.1 resolves to parent 1.0.1
>> and uses version
>>> 1.0.1 for itself
>>> But what happens to original V1.0.0 as soon as the V1.0.1 parent is
>> present in any repository? It will resolv V1.0.1 because this is the
>> newest. And know you have to childs, both of them telling you that they are
>> V1.0.1.
>>> 
>>> No thats really bad.
>>> 
>>> 
>>> Maybe I am wrong and deploy-goal does more I am knowing of :)
>>> 
>>> 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-unsubscribe@maven.apache.org<javascript:;>
>>> For additional commands, e-mail: users-help@maven.apache.org<javascript:;>
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org <javascript:;>
>> For additional commands, e-mail: users-help@maven.apache.org<javascript:;>
>> 
>> 

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


Re: Inherit parent version?

Posted by Stephen Connolly <st...@gmail.com>.
If by 'fixed' you mean RELEASE and LATEST no longer update, yes that
functionality is gone in 3.0 IIRC

On Saturday, 18 August 2012, Billy Newman wrote:

> Out of curiosity is this 'fixed' in maven 3?
>
> Thanks
>
> Sent from my iPhone
>
> On Aug 17, 2012, at 2:06 PM, "Gandhi, Pawan" <Gandhi.Pawan@pennmutual.com<javascript:;>>
> wrote:
>
> > Not bad in all cases. Can be bad in dependency resolution which no
> longer used in parent pom in my case.
> >
> > In my case, parent-pom is what provides me a centralized maven config
> helpful for build server to control all plugins, profiles, site related
> stuff, distributionManagement.
> >
> >
> >
> > Thanks
> > Pawan
> >
> > -----Original Message-----
> > From: Martin Eisengardt [mailto:martin.eisengardt@gmail.com<javascript:;>
> ]
> > Sent: Friday, August 17, 2012 1:15 PM
> > To: Maven Users List
> > Subject: Re: Inherit parent version?
> >
> > IMHO this solution is very bad because of one reason: It influences
> already released versions. IMHO mavens "deploy" goal does not put the
> correct resolved version into the parent tag. Thus all versions you ever
> deploy will resolut in corrupt poms because they lead to newer parent poms
> as soon as there is a new release an thus receive a newer version name on
> themselves.
> >
> > following scenario:
> > Parent V1.0.0 --> Child V1.0.0 resolves to parent 1.0.0 and uses version
> 1.0.0 for itself Parent V1.0.1 --> Child V1.0.1 resolves to parent 1.0.1
> and uses version
> > 1.0.1 for itself
> > But what happens to original V1.0.0 as soon as the V1.0.1 parent is
> present in any repository? It will resolv V1.0.1 because this is the
> newest. And know you have to childs, both of them telling you that they are
> V1.0.1.
> >
> > No thats really bad.
> >
> >
> > Maybe I am wrong and deploy-goal does more I am knowing of :)
> >
> > 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-unsubscribe@maven.apache.org<javascript:;>
> > For additional commands, e-mail: users-help@maven.apache.org<javascript:;>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org <javascript:;>
> For additional commands, e-mail: users-help@maven.apache.org<javascript:;>
>
>

Re: Inherit parent version?

Posted by Billy Newman <ne...@gmail.com>.
Out of curiosity is this 'fixed' in maven 3?

Thanks

Sent from my iPhone

On Aug 17, 2012, at 2:06 PM, "Gandhi, Pawan" <Ga...@pennmutual.com> wrote:

> Not bad in all cases. Can be bad in dependency resolution which no longer used in parent pom in my case.
> 
> In my case, parent-pom is what provides me a centralized maven config helpful for build server to control all plugins, profiles, site related stuff, distributionManagement. 
> 
> 
> 
> Thanks
> Pawan
> 
> -----Original Message-----
> From: Martin Eisengardt [mailto:martin.eisengardt@gmail.com]
> Sent: Friday, August 17, 2012 1:15 PM
> To: Maven Users List
> Subject: Re: Inherit parent version?
> 
> IMHO this solution is very bad because of one reason: It influences already released versions. IMHO mavens "deploy" goal does not put the correct resolved version into the parent tag. Thus all versions you ever deploy will resolut in corrupt poms because they lead to newer parent poms as soon as there is a new release an thus receive a newer version name on themselves.
> 
> following scenario:
> Parent V1.0.0 --> Child V1.0.0 resolves to parent 1.0.0 and uses version 1.0.0 for itself Parent V1.0.1 --> Child V1.0.1 resolves to parent 1.0.1 and uses version
> 1.0.1 for itself
> But what happens to original V1.0.0 as soon as the V1.0.1 parent is present in any repository? It will resolv V1.0.1 because this is the newest. And know you have to childs, both of them telling you that they are V1.0.1.
> 
> No thats really bad.
> 
> 
> Maybe I am wrong and deploy-goal does more I am knowing of :)
> 
> 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-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: Inherit parent version?

Posted by "Gandhi, Pawan" <Ga...@pennmutual.com>.
Not bad in all cases. Can be bad in dependency resolution which no longer used in parent pom in my case.

In my case, parent-pom is what provides me a centralized maven config helpful for build server to control all plugins, profiles, site related stuff, distributionManagement. 



Thanks
Pawan

-----Original Message-----
From: Martin Eisengardt [mailto:martin.eisengardt@gmail.com] 
Sent: Friday, August 17, 2012 1:15 PM
To: Maven Users List
Subject: Re: Inherit parent version?

IMHO this solution is very bad because of one reason: It influences already released versions. IMHO mavens "deploy" goal does not put the correct resolved version into the parent tag. Thus all versions you ever deploy will resolut in corrupt poms because they lead to newer parent poms as soon as there is a new release an thus receive a newer version name on themselves.

following scenario:
Parent V1.0.0 --> Child V1.0.0 resolves to parent 1.0.0 and uses version 1.0.0 for itself Parent V1.0.1 --> Child V1.0.1 resolves to parent 1.0.1 and uses version
1.0.1 for itself
But what happens to original V1.0.0 as soon as the V1.0.1 parent is present in any repository? It will resolv V1.0.1 because this is the newest. And know you have to childs, both of them telling you that they are V1.0.1.

No thats really bad.


Maybe I am wrong and deploy-goal does more I am knowing of :)

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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Inherit parent version?

Posted by Martin Eisengardt <ma...@gmail.com>.
IMHO this solution is very bad because of one reason: It influences already
released versions. IMHO mavens "deploy" goal does not put the correct
resolved version into the parent tag. Thus all versions you ever deploy
will resolut in corrupt poms because they lead to newer parent poms as soon
as there is a new release an thus receive a newer version name on
themselves.

following scenario:
Parent V1.0.0 --> Child V1.0.0 resolves to parent 1.0.0 and uses version
1.0.0 for itself
Parent V1.0.1 --> Child V1.0.1 resolves to parent 1.0.1 and uses version
1.0.1 for itself
But what happens to original V1.0.0 as soon as the V1.0.1 parent is present
in any repository? It will resolv V1.0.1 because this is the newest. And
know you have to childs, both of them telling you that they are V1.0.1.

No thats really bad.


Maybe I am wrong and deploy-goal does more I am knowing of :)

RE: Inherit parent version?

Posted by Anders Hammar <an...@hammar.net>.
NO! That is not a good solution.
RELEASE and LATEST are deprecated.

/Anders (mobile)
Den 17 aug 2012 19.07 skrev "Gandhi, Pawan" <Ga...@pennmutual.com>:

> 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:newmanw10@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-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@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-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

RE: Inherit parent version?

Posted by "Gandhi, Pawan" <Ga...@pennmutual.com>.
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:newmanw10@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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Inherit parent version?

Posted by Martin Eisengardt <ma...@gmail.com>.
No, it is not possible.
This is henn-egg-problem. The first thing maven does is: resolve the parent
pom. So in the parent section there is neither a way to comment out the
version number nor a way to use properties.

Re: Inherit parent version?

Posted by Aliaksei Lahachou <al...@gmail.com>.
Hello,

you are right, you have to specify the version of the parent, so you cannot
leave the version in one place only. But there are some mojos which help
managing the version. See versions-maven-plugin and release-maven-plugin.


Regards,
htfv (Aliaksei Lahachou)


On Fri, Aug 17, 2012 at 5:56 PM, Billy Newman <ne...@gmail.com> wrote:

> 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-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>