You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Nick Pellow <np...@atlassian.com> on 2008/10/29 06:49:12 UTC

overriding via a profile

Hi,

If a plugin is defined in the normal build section of a pom and has  
defined a specific execution, is it possible to override this  
execution by defining the same plugin in a profile?

The plugin I am working on, uses a forked build lifecycle, so when I  
try to do this, I see the executions defined outside the profile being  
run, as well as those defined in the profile. Ideally, I'd like the  
executions defined for the plugin outside the profile completely  
ignored when the profile is activated.

e.g.

  <build>
         <plugins>
             <plugin>
                 <artifactId>plugin</artifactId>
                 <executions>
                     <execution>
                         <id>execution1</id>
                         <phase>verify</phase>
                         <goals>
                             <goal>goal1</goal>
                             <goal>goal2r</goal>
                         </goals>
                     </execution>
                 </executions>
             </plugin>
         </plugins>
     </build>


and then inside a profile:

<profiles>
   <profile>
     <build>
         <plugins>
             <plugin>
                 <artifactId>plugin</artifactId>
                 <executions>
                     <execution>
                         <id>execution1</id>
                         <phase>verify</phase>
                         <goals>
    			<!-- no goals -->
                         </goals>
                     </execution>
                 </executions>
             </plugin>
         </plugins>
     </build>
   </profile>
</profiles>

Cheers,
Nick Pellow

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


Re: overriding via a profile

Posted by Barrie Treloar <ba...@gmail.com>.
On Wed, Oct 29, 2008 at 4:19 PM, Nick Pellow <np...@atlassian.com> wrote:
> Hi,
>
> If a plugin is defined in the normal build section of a pom and has defined
> a specific execution, is it possible to override this execution by defining
> the same plugin in a profile?
>
> The plugin I am working on, uses a forked build lifecycle, so when I try to
> do this, I see the executions defined outside the profile being run, as well
> as those defined in the profile. Ideally, I'd like the executions defined
> for the plugin outside the profile completely ignored when the profile is
> activated.

An alternative is to not use a forked lifecycle.
A lot of plugins have an "attached" or "only" equivalent that do not
run in the reactor to avoid these problems. There is an outstanding
JIRA somewhere to fix this lifecycle issue in 3.x.

You could also have both of these definitions in profiles and switch
between them as needed (maybe via a boolean flag so that one of the
profiles is in use)

However you cant *deactivate* a profile.
So this would be something the user had to remember to type every time.

For the forum link you posted, I would recommend not adding clover to
the default build list, but pull this out into its own plugin. This is
something your CI environment would want to run but the average
developer doesnt really care.  When the developer does want to run it
they can activate the profile.

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


Re: overriding via a profile

Posted by Nick Pellow <np...@atlassian.com>.
A concrete manifestation of this problem is outlined here: http://forums.atlassian.com/thread.jspa?messageID=257293240

Ideally - could we add another sub-element to the <execution> element  
which decides whether or not to merge the configuration defined in the  
profile with that in the default definition,  <merge/> ?

What are your thoughts on adding another option for this? I am  
guessing other plugins will also not want to merge <executions> from  
profiles.

Cheers,
Nick

On 11/11/2008, at 11:39 AM, Nick Pellow wrote:

> Hi Brian,
>
> Even changing the executions to something else doesn't appear to work.
>
> Is there anything my plugin can do, to prevent the executions in the  
> default plugin definition being merged with those defined in a  
> profile?
>
>
> Cheers,
> Nick
>
> On 30/10/2008, at 12:49 AM, Brian Fox wrote:
>
>> You can't unset something like that because it appears null and the  
>> merge will overwrite it. You could change it to something else though
>>
>> --Brian (mobile)
>>
>>
>> On Oct 29, 2008, at 1:49 AM, Nick Pellow <np...@atlassian.com>  
>> wrote:
>>
>>> Hi,
>>>
>>> If a plugin is defined in the normal build section of a pom and  
>>> has defined a specific execution, is it possible to override this  
>>> execution by defining the same plugin in a profile?
>>>
>>> The plugin I am working on, uses a forked build lifecycle, so when  
>>> I try to do this, I see the executions defined outside the profile  
>>> being run, as well as those defined in the profile. Ideally, I'd  
>>> like the executions defined for the plugin outside the profile  
>>> completely ignored when the profile is activated.
>>>
>>> e.g.
>>>
>>> <build>
>>>      <plugins>
>>>          <plugin>
>>>              <artifactId>plugin</artifactId>
>>>              <executions>
>>>                  <execution>
>>>                      <id>execution1</id>
>>>                      <phase>verify</phase>
>>>                      <goals>
>>>                          <goal>goal1</goal>
>>>                          <goal>goal2r</goal>
>>>                      </goals>
>>>                  </execution>
>>>              </executions>
>>>          </plugin>
>>>      </plugins>
>>>  </build>
>>>
>>>
>>> and then inside a profile:
>>>
>>> <profiles>
>>> <profile>
>>>  <build>
>>>      <plugins>
>>>          <plugin>
>>>              <artifactId>plugin</artifactId>
>>>              <executions>
>>>                  <execution>
>>>                      <id>execution1</id>
>>>                      <phase>verify</phase>
>>>                      <goals>
>>>             <!-- no goals -->
>>>                      </goals>
>>>                  </execution>
>>>              </executions>
>>>          </plugin>
>>>      </plugins>
>>>  </build>
>>> </profile>
>>> </profiles>
>>>
>>> Cheers,
>>> Nick Pellow
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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: overriding via a profile

Posted by Nick Pellow <np...@atlassian.com>.
Hi Brian,

Even changing the executions to something else doesn't appear to work.

Is there anything my plugin can do, to prevent the executions in the  
default plugin definition being merged with those defined in a profile?


Cheers,
Nick

On 30/10/2008, at 12:49 AM, Brian Fox wrote:

> You can't unset something like that because it appears null and the  
> merge will overwrite it. You could change it to something else though
>
> --Brian (mobile)
>
>
> On Oct 29, 2008, at 1:49 AM, Nick Pellow <np...@atlassian.com>  
> wrote:
>
>> Hi,
>>
>> If a plugin is defined in the normal build section of a pom and has  
>> defined a specific execution, is it possible to override this  
>> execution by defining the same plugin in a profile?
>>
>> The plugin I am working on, uses a forked build lifecycle, so when  
>> I try to do this, I see the executions defined outside the profile  
>> being run, as well as those defined in the profile. Ideally, I'd  
>> like the executions defined for the plugin outside the profile  
>> completely ignored when the profile is activated.
>>
>> e.g.
>>
>> <build>
>>       <plugins>
>>           <plugin>
>>               <artifactId>plugin</artifactId>
>>               <executions>
>>                   <execution>
>>                       <id>execution1</id>
>>                       <phase>verify</phase>
>>                       <goals>
>>                           <goal>goal1</goal>
>>                           <goal>goal2r</goal>
>>                       </goals>
>>                   </execution>
>>               </executions>
>>           </plugin>
>>       </plugins>
>>   </build>
>>
>>
>> and then inside a profile:
>>
>> <profiles>
>> <profile>
>>   <build>
>>       <plugins>
>>           <plugin>
>>               <artifactId>plugin</artifactId>
>>               <executions>
>>                   <execution>
>>                       <id>execution1</id>
>>                       <phase>verify</phase>
>>                       <goals>
>>              <!-- no goals -->
>>                       </goals>
>>                   </execution>
>>               </executions>
>>           </plugin>
>>       </plugins>
>>   </build>
>> </profile>
>> </profiles>
>>
>> Cheers,
>> Nick Pellow
>>
>> ---------------------------------------------------------------------
>> 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
>


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


Re: overriding via a profile

Posted by Brian Fox <br...@reply.infinity.nu>.
You can't unset something like that because it appears null and the  
merge will overwrite it. You could change it to something else though

--Brian (mobile)


On Oct 29, 2008, at 1:49 AM, Nick Pellow <np...@atlassian.com> wrote:

> Hi,
>
> If a plugin is defined in the normal build section of a pom and has  
> defined a specific execution, is it possible to override this  
> execution by defining the same plugin in a profile?
>
> The plugin I am working on, uses a forked build lifecycle, so when I  
> try to do this, I see the executions defined outside the profile  
> being run, as well as those defined in the profile. Ideally, I'd  
> like the executions defined for the plugin outside the profile  
> completely ignored when the profile is activated.
>
> e.g.
>
> <build>
>        <plugins>
>            <plugin>
>                <artifactId>plugin</artifactId>
>                <executions>
>                    <execution>
>                        <id>execution1</id>
>                        <phase>verify</phase>
>                        <goals>
>                            <goal>goal1</goal>
>                            <goal>goal2r</goal>
>                        </goals>
>                    </execution>
>                </executions>
>            </plugin>
>        </plugins>
>    </build>
>
>
> and then inside a profile:
>
> <profiles>
>  <profile>
>    <build>
>        <plugins>
>            <plugin>
>                <artifactId>plugin</artifactId>
>                <executions>
>                    <execution>
>                        <id>execution1</id>
>                        <phase>verify</phase>
>                        <goals>
>               <!-- no goals -->
>                        </goals>
>                    </execution>
>                </executions>
>            </plugin>
>        </plugins>
>    </build>
>  </profile>
> </profiles>
>
> Cheers,
> Nick Pellow
>
> ---------------------------------------------------------------------
> 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