Quantcast

Maven 2 inheritance which elements get inherited ?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Maven 2 inheritance which elements get inherited ?

kukudas
I have read in the documentation that the following elements get inherited (merged) :

    * dependencies
    * developers and contributors
    * plugin lists (including reports)
    * plugin executions with matching ids
    * plugin configuration
    * resources

Is it possible to inherit other elements too like certain profiles ?
Thanks in advance .. kuku
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Maven 2 inheritance which elements get inherited ?

Jörg Schaible
Hi kuku,

kukudas wrote at Mittwoch, 28. Januar 2009 09:24:

>
> I have read in the documentation that the following elements get inherited
> (merged) :
>
>     * dependencies
>     * developers and contributors
>     * plugin lists (including reports)
>     * plugin executions with matching ids
>     * plugin configuration
>     * resources
>
> Is it possible to inherit other elements too like certain profiles ?
> Thanks in advance .. kuku

Profiles are not inherited, they get activated. I.e. if a profile get's
activated in a parent pom, anything that is part of this profile definition
will be inherited as if it had been declared outside of the profile.
However, the activation of the profile is inherited i.e. if you child POM
declares a profile with the same profile id but without any activation
section, it is nevertheless active and you can add or modify other POM
elements.

Those commands will help you to visualize the effects:

mvn help:active-profiles
mvn help:effective-pom

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Maven 2 inheritance which elements get inherited ?

kukudas
Ok so lets say i have a profile in my parent which is not activated. If i now call this profile with my child it will work right? I've tried it and it seems to work but i'm asking to be sure.

Jörg Schaible-2 wrote
Hi kuku,

kukudas wrote at Mittwoch, 28. Januar 2009 09:24:

>
> I have read in the documentation that the following elements get inherited
> (merged) :
>
>     * dependencies
>     * developers and contributors
>     * plugin lists (including reports)
>     * plugin executions with matching ids
>     * plugin configuration
>     * resources
>
> Is it possible to inherit other elements too like certain profiles ?
> Thanks in advance .. kuku

Profiles are not inherited, they get activated. I.e. if a profile get's
activated in a parent pom, anything that is part of this profile definition
will be inherited as if it had been declared outside of the profile.
However, the activation of the profile is inherited i.e. if you child POM
declares a profile with the same profile id but without any activation
section, it is nevertheless active and you can add or modify other POM
elements.

Those commands will help you to visualize the effects:

mvn help:active-profiles
mvn help:effective-pom

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Maven 2 inheritance which elements get inherited ?

Jörg Schaible
Hi kuku,

kukudas wrote at Mittwoch, 28. Januar 2009 13:37:

>
> Ok so lets say i have a profile in my parent which is not activated. If i
> now call this profile with my child it will work right? I've tried it and
> it seems to work but i'm asking to be sure.

No. If the profile is activated (i.e. by an activate element in the profile
itself) in the child, none of the profile stuff of the parent is used.
Parents are resolved first (incl. profiles). If you activate a profile from
command line the case is different, then the profile activation happens
before any of the POMs are resolved independently from an activate section.

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Maven 2 inheritance which elements get inherited ?

kukudas
Thanks, so when i activate a profile by using the command line (ex.: mvn clean install -P int) within a child and the profile (int) is definied in the parent it should work right?
Jörg Schaible-2 wrote
Hi kuku,

kukudas wrote at Mittwoch, 28. Januar 2009 13:37:

>
> Ok so lets say i have a profile in my parent which is not activated. If i
> now call this profile with my child it will work right? I've tried it and
> it seems to work but i'm asking to be sure.

No. If the profile is activated (i.e. by an activate element in the profile
itself) in the child, none of the profile stuff of the parent is used.
Parents are resolved first (incl. profiles). If you activate a profile from
command line the case is different, then the profile activation happens
before any of the POMs are resolved independently from an activate section.

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Maven 2 inheritance which elements get inherited ?

Jörg Schaible
Hi kuku,

kukudas wrote at Mittwoch, 28. Januar 2009 15:20:

>
> Thanks, so when i activate a profile by using the command line (ex.: mvn
> clean install -P int) within a child and the profile (int) is definied in
> the parent it should work right?

Yes, but why don't you simply setup two minimal POMs and use "mvn
effetive:pom" to explore the results ?

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Maven 2 inheritance which elements get inherited ?

kukudas
Thanks i did that too but the profiles were missing so i wanted to be sure and asked here.
Thanks for your help.
Jörg Schaible-2 wrote
Hi kuku,

kukudas wrote at Mittwoch, 28. Januar 2009 15:20:

>
> Thanks, so when i activate a profile by using the command line (ex.: mvn
> clean install -P int) within a child and the profile (int) is definied in
> the parent it should work right?

Yes, but why don't you simply setup two minimal POMs and use "mvn
effetive:pom" to explore the results ?

- Jörg


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