You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Farrukh Najmi <fa...@wellfleetsoftware.com> on 2008/04/04 16:12:00 UTC

Can sub pom have different version than super pom

Dear Colleagues,

I have two separate projects "base" and "extension".
Each project is really a multi-project inheritance hierarchy.
Finally extension pom is a sub pom of base pom.

The pom inheritance is as follows:

base
    base-sub1
    base-sub2

    extension
        extension-sub1
        extension-sub2

Since base and pom are separately released projects they need to be 
version independent of each other.

For example it should be possible for version 2.0 of base be the parent 
pom of version 1.0 of extension.

I recently discovered that this may not be possible. It seems that if I 
give extension pom a version it applies the same
version to parent during build even though parent was give a separate 
and explicit version:

<project>
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>base</groupId>
        <artifactId>base</artifactId>
        <version>2.0</version>
    </parent>
   
    <groupId>derived</groupId>
    <artifactId>derived</artifactId>
    <version>1.0</version>

    ...
</project>

It appears that building above pom causes version 1.0 of base to be used 
instead of 2.0.

What am I doing wrong?

-- 
Regards,
Farrukh Najmi

Web: http://www.wellfleetsoftware.com



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


Re: Can sub pom have different version than super pom

Posted by Farrukh Najmi <fa...@wellfleetsoftware.com>.
Here is what learned about my problem:

    * It is certainly possible to have a child pom (extension) have a
      different version that its parent pom (base) - (good!)
    * My problem was due to use of variable ${pom.parent.version} within
      dependencyManagement section. Apparently the variable gets
      resolved in the child poms of extension and not where is is
      defined. This was causing incorrect version to be picked up

The fix was to hard-code the version in dependencyManagement section of 
extension.pom to be same as the pom.parent.version in extension.pom.

Thanks.

Farrukh Najmi wrote:
>
> If this is not possible then whats is the best way to avoid 
> duplication of conetnt between base.pom and extension.pom?
>
> Also please see a typo fix inline below...
>
> Farrukh Najmi wrote:
>> Dear Colleagues,
>>
>> I have two separate projects "base" and "extension".
>> Each project is really a multi-project inheritance hierarchy.
>> Finally extension pom is a sub pom of base pom.
>>
>> The pom inheritance is as follows:
>>
>> base
>>    base-sub1
>>    base-sub2
>>
>>    extension
>>        extension-sub1
>>        extension-sub2
>>
>> Since base and pom are separately released projects they need to be 
>> version independent of each other.
>>
>> For example it should be possible for version 2.0 of base be the 
>> parent pom of version 1.0 of extension.
>>
>> I recently discovered that this may not be possible. It seems that if 
>> I give extension pom a version it applies the same
>> version to parent during build even though parent was give a separate 
>> and explicit version:
>>
>> <project>
>>    <modelVersion>4.0.0</modelVersion>
>>    <parent>
>>        <groupId>base</groupId>
>>        <artifactId>base</artifactId>
>>        <version>2.0</version>
>>    </parent>
>>      <groupId>derived</groupId>
>>    <artifactId>derived</artifactId>
>>    <version>1.0</version>
>>
>>    ...
>> </project>
>
> Oops above should have read:
>
> <project>
>   <modelVersion>4.0.0</modelVersion>
>   <parent>
>       <groupId>base</groupId>
>       <artifactId>base</artifactId>
>       <version>2.0</version>
>   </parent>
>     <groupId>extension</groupId>
>   <artifactId>extension</artifactId>
>   <version>1.0</version>
>
>   ...
> </project>
>
>>
>> It appears that building above pom causes version 1.0 of base to be 
>> used instead of 2.0.
>>
>> What am I doing wrong?
>>
>
>


-- 
Regards,
Farrukh Najmi

Web: http://www.wellfleetsoftware.com



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


Re: Can sub pom have different version than super pom

Posted by Farrukh Najmi <fa...@wellfleetsoftware.com>.
If this is not possible then whats is the best way to avoid duplication 
of conetnt between base.pom and extension.pom?

Also please see a typo fix inline below...

Farrukh Najmi wrote:
> Dear Colleagues,
>
> I have two separate projects "base" and "extension".
> Each project is really a multi-project inheritance hierarchy.
> Finally extension pom is a sub pom of base pom.
>
> The pom inheritance is as follows:
>
> base
>    base-sub1
>    base-sub2
>
>    extension
>        extension-sub1
>        extension-sub2
>
> Since base and pom are separately released projects they need to be 
> version independent of each other.
>
> For example it should be possible for version 2.0 of base be the 
> parent pom of version 1.0 of extension.
>
> I recently discovered that this may not be possible. It seems that if 
> I give extension pom a version it applies the same
> version to parent during build even though parent was give a separate 
> and explicit version:
>
> <project>
>    <modelVersion>4.0.0</modelVersion>
>    <parent>
>        <groupId>base</groupId>
>        <artifactId>base</artifactId>
>        <version>2.0</version>
>    </parent>
>      <groupId>derived</groupId>
>    <artifactId>derived</artifactId>
>    <version>1.0</version>
>
>    ...
> </project>

Oops above should have read:

<project>
   <modelVersion>4.0.0</modelVersion>
   <parent>
       <groupId>base</groupId>
       <artifactId>base</artifactId>
       <version>2.0</version>
   </parent>
     <groupId>extension</groupId>
   <artifactId>extension</artifactId>
   <version>1.0</version>

   ...
</project>

>
> It appears that building above pom causes version 1.0 of base to be 
> used instead of 2.0.
>
> What am I doing wrong?
>


-- 
Regards,
Farrukh Najmi

Web: http://www.wellfleetsoftware.com



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