You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Rémy Sanlaville <re...@gmail.com> on 2007/02/16 16:30:04 UTC

[Proposal] New profile activation

I would like to propose a new profile activation.

As described in
http://www.nabble.com/Execute-only-in-the-parent-POM-and-some-sub-modules---tf3201453s177.html#a8889223
, I need to execute a plugin only for some sub-modules from the parent pom.
For instance to generate the project web site.

I can do this with profiles :

    <profiles>
        <profile>
            <id>site</id>
            <modules>
                <module>moduleA</module>
                <module>moduleB</module>
            </modules>
        </profile>

        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <modules>
                <module>moduleA</module>
                <module>moduleB</module>
                <module>moduleC</module>
            </modules>
        </profile>
    </profiles>

mvn compile : compile all my three modules
mvn site -Psite : generates the web site only for the modules A and B

That's nice but it could be very interesting to activate my site profile
only when the site is generate. In other word, it would be nice to attach a
profile to a phase. I will have the possibility to do this :

mvn compile : compile all my three modules => activate default profiles
mvn site : generates the web site only for the modules A and B => activate
site profile

This is very useful at least for three reasons :
   - I will not have to explain to all the developers that they now have to
add -Psite ;
   - We won't forget to add -Psite ;
   - I will have the possibility to execute (I hope) : mvn package site.
Interesting with CI like continuum.

We could either activate a profile to a phase if its id has the same name of
the corresponding phase :
        <profile>
            <id>site</id>

or with an activation section
        <profile>
            <id>mySiteProfile1</id>
            <activation>
                <phase>site</phase>
            </activation>

Hope it's enough clear.

Rémy

Re: [Proposal] New profile activation

Posted by Rémy Sanlaville <re...@gmail.com>.
Hi Wayne

Yes, you have right. It certainly the best solution and it will be simpler.
I also think that it better to use profile just for some cases.
I was looking for this feature. As it doesn't exist yet, I used profiles
instead.

Rémy

2007/2/17, Wayne Fay <wa...@gmail.com>:
>
> Would it perhaps be sufficient to add a <skip> configuration to all
> plugins, such that you could declare the plugin the parent, and then
> add a <skip>true in the plugin definition in the children which would
> cause that plugin to be skipped for that specific child/module?
>
> Just trying to think of some ways to implement this feature request...
>
> Wayne
>
>

Re: [Proposal] New profile activation

Posted by Rémy Sanlaville <re...@gmail.com>.
Hi Kennedy,

> Just trying to think of some ways to implement this feature request...
>
> I think this is the only feasible option right now.


Yes, and it's better to use the Wayne's proposal.

'site' is not a phase, it's a lifecycle. It may be possible
> to add a profile activator based on lifecycle. It's not
> possible (at least right now) to activate a profile
> for a specific phase.
> POM files are fully resolved (interpolated, merged, profiles
> applied) before any phase is executed. What would happen
> if you added a profile for phase test that added some modules?
> If you mvn test, first compile is called on all projects
> but the modules, then test is executed but there won't be
> any tests to execute.


Thanks for the information. It's a little bit clearer now.

Rémy

Re: [Proposal] New profile activation

Posted by Kenney Westerhof <ke...@apache.org>.

Wayne Fay wrote:
> Would it perhaps be sufficient to add a <skip> configuration to all
> plugins, such that you could declare the plugin the parent, and then
> add a <skip>true in the plugin definition in the children which would
> cause that plugin to be skipped for that specific child/module?
> 
> Just trying to think of some ways to implement this feature request...

I think this is the only feasible option right now.

> 
> Wayne
> 
> On 2/16/07, Rémy Sanlaville <re...@gmail.com> wrote:
>> I would like to propose a new profile activation.
>>
>> As described in
>> http://www.nabble.com/Execute-only-in-the-parent-POM-and-some-sub-modules---tf3201453s177.html#a8889223 


'site' is not a phase, it's a lifecycle. It may be possible
to add a profile activator based on lifecycle. It's not
possible (at least right now) to activate a profile
for a specific phase. 
POM files are fully resolved (interpolated, merged, profiles 
applied) before any phase is executed. What would happen
if you added a profile for phase test that added some modules?
If you mvn test, first compile is called on all projects
but the modules, then test is executed but there won't be
any tests to execute.

Is there maybe some difference in module c, below? For instance,
packaging? A profile activator based on packaging is pretty easy.

-- Kenney

>>
>> , I need to execute a plugin only for some sub-modules from the parent 
>> pom.
>> For instance to generate the project web site.
>>
>> I can do this with profiles :
>>
>>     <profiles>
>>         <profile>
>>             <id>site</id>
>>             <modules>
>>                 <module>moduleA</module>
>>                 <module>moduleB</module>
>>             </modules>
>>         </profile>
>>
>>         <profile>
>>             <id>default</id>
>>             <activation>
>>                 <activeByDefault>true</activeByDefault>
>>             </activation>
>>             <modules>
>>                 <module>moduleA</module>
>>                 <module>moduleB</module>
>>                 <module>moduleC</module>
>>             </modules>
>>         </profile>
>>     </profiles>
>>
>> mvn compile : compile all my three modules
>> mvn site -Psite : generates the web site only for the modules A and B
>>
>> That's nice but it could be very interesting to activate my site profile
>> only when the site is generate. In other word, it would be nice to 
>> attach a
>> profile to a phase. I will have the possibility to do this :
>>
>> mvn compile : compile all my three modules => activate default profiles
>> mvn site : generates the web site only for the modules A and B => 
>> activate
>> site profile
>>
>> This is very useful at least for three reasons :
>>    - I will not have to explain to all the developers that they now 
>> have to
>> add -Psite ;
>>    - We won't forget to add -Psite ;
>>    - I will have the possibility to execute (I hope) : mvn package site.
>> Interesting with CI like continuum.
>>
>> We could either activate a profile to a phase if its id has the same 
>> name of
>> the corresponding phase :
>>         <profile>
>>             <id>site</id>
>>
>> or with an activation section
>>         <profile>
>>             <id>mySiteProfile1</id>
>>             <activation>
>>                 <phase>site</phase>
>>             </activation>
>>
>> Hope it's enough clear.
>>
>> Rémy
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 


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


Re: [Proposal] New profile activation

Posted by Wayne Fay <wa...@gmail.com>.
Would it perhaps be sufficient to add a <skip> configuration to all
plugins, such that you could declare the plugin the parent, and then
add a <skip>true in the plugin definition in the children which would
cause that plugin to be skipped for that specific child/module?

Just trying to think of some ways to implement this feature request...

Wayne

On 2/16/07, Rémy Sanlaville <re...@gmail.com> wrote:
> I would like to propose a new profile activation.
>
> As described in
> http://www.nabble.com/Execute-only-in-the-parent-POM-and-some-sub-modules---tf3201453s177.html#a8889223
> , I need to execute a plugin only for some sub-modules from the parent pom.
> For instance to generate the project web site.
>
> I can do this with profiles :
>
>     <profiles>
>         <profile>
>             <id>site</id>
>             <modules>
>                 <module>moduleA</module>
>                 <module>moduleB</module>
>             </modules>
>         </profile>
>
>         <profile>
>             <id>default</id>
>             <activation>
>                 <activeByDefault>true</activeByDefault>
>             </activation>
>             <modules>
>                 <module>moduleA</module>
>                 <module>moduleB</module>
>                 <module>moduleC</module>
>             </modules>
>         </profile>
>     </profiles>
>
> mvn compile : compile all my three modules
> mvn site -Psite : generates the web site only for the modules A and B
>
> That's nice but it could be very interesting to activate my site profile
> only when the site is generate. In other word, it would be nice to attach a
> profile to a phase. I will have the possibility to do this :
>
> mvn compile : compile all my three modules => activate default profiles
> mvn site : generates the web site only for the modules A and B => activate
> site profile
>
> This is very useful at least for three reasons :
>    - I will not have to explain to all the developers that they now have to
> add -Psite ;
>    - We won't forget to add -Psite ;
>    - I will have the possibility to execute (I hope) : mvn package site.
> Interesting with CI like continuum.
>
> We could either activate a profile to a phase if its id has the same name of
> the corresponding phase :
>         <profile>
>             <id>site</id>
>
> or with an activation section
>         <profile>
>             <id>mySiteProfile1</id>
>             <activation>
>                 <phase>site</phase>
>             </activation>
>
> Hope it's enough clear.
>
> Rémy
>

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