You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Kiren Pillay <ki...@gmail.com> on 2011/09/29 11:32:54 UTC

Parent Dependencies

Hi All

We have a project with multi-level modules.


Main ---- core------dao
         +---business

>From what I've read, if I've defined the dependency in the Main
module, I don't need to repeat the defintion the dao module. Is this
correct, because it doesn't seem to work for me?

Regards
Kiren

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


Re: Parent Dependencies

Posted by Guillaume Polet <gu...@gmail.com>.
Sure, the inheritance is transitive. You can have as many levels as you 
want:
If you have a hierarchy like this:

  * A
      o B
          + C

All dependencies declared in A will also be available for B and C and 
all dependencies declared in B will also be available for C.

Guillaume

Le 29/09/2011 12:57, Kiren Pillay a écrit :
> Thanks for the explanation Guillame...this works as you've stated.
>
> However my question is, is the inheritance transitive, i.e, the child
> pom would inherit the dependencies of the "grandparent" pom? From what
> I'm seeing this is not the case.
>
> Regards
>
> On Thu, Sep 29, 2011 at 11:43 AM, Guillaume Polet
> <gu...@gmail.com>  wrote:
>> I am not sure I understood you correctly but here is what I can tell:
>> Let's say you have a Main project which contains two modules: dao and
>> business:
>>
>>   * Main
>>      o dao
>>      o business
>>
>> If in your Main pom.xml,  you have defined the following:
>> <groupId>a.b.c</groupId>
>> <artifactId>Main</artifactId>
>> <version>1.0<version>
>>
>> <dependencies>
>> <dependency>
>> <groupId>x.y.z</groupId>
>> <artifactId>azerty</artifactId>
>> <version>1.0</version>
>> </dependency>
>> <dependencies>
>>
>> If in your dao pom.xml, you have defined the following
>> <parent>
>> <groupId>a.b.c</groupId>
>> <artifactId>Main</artifactId>
>> <version>1.0<version>
>> </parent>
>>
>> then yes, you should inherit the dependency provided in you Main pom.xml,
>> ie, in my example:
>> <groupId>x.y.z</groupId>
>> <artifactId>azerty</artifactId>
>> <version>1.0</version>
>>
>> Without any more information, it will be hard to help more I think.
>>
>> Cheers,
>> Guillaume
>> Le 29/09/2011 11:32, Kiren Pillay a écrit :
>>> Hi All
>>>
>>> We have a project with multi-level modules.
>>>
>>>
>>> Main ---- core------dao
>>>           +---business
>>>
>>>   From what I've read, if I've defined the dependency in the Main
>>> module, I don't need to repeat the defintion the dao module. Is this
>>> correct, because it doesn't seem to work for me?
>>>
>>> Regards
>>> Kiren
>>>
>>> ---------------------------------------------------------------------
>>> 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: Parent Dependencies

Posted by Kiren Pillay <ki...@gmail.com>.
Thanks for the explanation Guillame...this works as you've stated.

However my question is, is the inheritance transitive, i.e, the child
pom would inherit the dependencies of the "grandparent" pom? From what
I'm seeing this is not the case.

Regards

On Thu, Sep 29, 2011 at 11:43 AM, Guillaume Polet
<gu...@gmail.com> wrote:
> I am not sure I understood you correctly but here is what I can tell:
> Let's say you have a Main project which contains two modules: dao and
> business:
>
>  * Main
>     o dao
>     o business
>
> If in your Main pom.xml,  you have defined the following:
> <groupId>a.b.c</groupId>
> <artifactId>Main</artifactId>
> <version>1.0<version>
>
> <dependencies>
> <dependency>
> <groupId>x.y.z</groupId>
> <artifactId>azerty</artifactId>
> <version>1.0</version>
> </dependency>
> <dependencies>
>
> If in your dao pom.xml, you have defined the following
> <parent>
> <groupId>a.b.c</groupId>
> <artifactId>Main</artifactId>
> <version>1.0<version>
> </parent>
>
> then yes, you should inherit the dependency provided in you Main pom.xml,
> ie, in my example:
> <groupId>x.y.z</groupId>
> <artifactId>azerty</artifactId>
> <version>1.0</version>
>
> Without any more information, it will be hard to help more I think.
>
> Cheers,
> Guillaume
> Le 29/09/2011 11:32, Kiren Pillay a écrit :
>>
>> Hi All
>>
>> We have a project with multi-level modules.
>>
>>
>> Main ---- core------dao
>>          +---business
>>
>>  From what I've read, if I've defined the dependency in the Main
>> module, I don't need to repeat the defintion the dao module. Is this
>> correct, because it doesn't seem to work for me?
>>
>> Regards
>> Kiren
>>
>> ---------------------------------------------------------------------
>> 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: Parent Dependencies

Posted by Guillaume Polet <gu...@gmail.com>.
I am not sure I understood you correctly but here is what I can tell:
Let's say you have a Main project which contains two modules: dao and 
business:

  * Main
      o dao
      o business

If in your Main pom.xml,  you have defined the following:
<groupId>a.b.c</groupId>
<artifactId>Main</artifactId>
<version>1.0<version>

<dependencies>
<dependency>
<groupId>x.y.z</groupId>
<artifactId>azerty</artifactId>
<version>1.0</version>
</dependency>
<dependencies>

If in your dao pom.xml, you have defined the following
<parent>
<groupId>a.b.c</groupId>
<artifactId>Main</artifactId>
<version>1.0<version>
</parent>

then yes, you should inherit the dependency provided in you Main 
pom.xml, ie, in my example:
<groupId>x.y.z</groupId>
<artifactId>azerty</artifactId>
<version>1.0</version>

Without any more information, it will be hard to help more I think.

Cheers,
Guillaume
Le 29/09/2011 11:32, Kiren Pillay a écrit :
> Hi All
>
> We have a project with multi-level modules.
>
>
> Main ---- core------dao
>           +---business
>
>  From what I've read, if I've defined the dependency in the Main
> module, I don't need to repeat the defintion the dao module. Is this
> correct, because it doesn't seem to work for me?
>
> Regards
> Kiren
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>