You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dominic Mitchell <do...@semantico.com> on 2009/08/05 14:44:57 UTC

Profile activation based on current plugin?

Hi all,

I'm wondering — is there a way to activate a profile based on the  
plugin specified on the command line?

The reason for this is that I'm working with a cocoon project.   
Normally, the cocoon plugin gets bound to compile:

       <plugin>
         <groupId>org.apache.cocoon</groupId>
         <artifactId>cocoon-maven-plugin</artifactId>
         <version>1.0.0-M2</version>
         <executions>
           <execution>
             <id>prepare</id>
             <phase>compile</phase>
             <goals>
               <goal>prepare</goal>
             </goals>
           </execution>
         </executions>
         <configuration>
           <customLog4jXconf>etc/log4j.xml</customLog4jXconf>
         </configuration>
       </plugin>

However, I only really care that this happens when I invoke mvn  
jetty:run on the command line.  Otherwise, it's just wasted effort.  I  
was thinking that I could make this into a profile, but I'm not sure  
how.  Or if that's even possible.

Thanks,
-Dom

Re: Profile activation based on current plugin?

Posted by Alexander <th...@gmail.com>.
Hi,

You could activate a profile by -Pprofile flag in comman line. Wont help
you? [?]

2009/8/5 Dominic Mitchell <do...@semantico.com>

> Hi all,
>
> I'm wondering — is there a way to activate a profile based on the plugin
> specified on the command line?
>
> The reason for this is that I'm working with a cocoon project.  Normally,
> the cocoon plugin gets bound to compile:
>
>      <plugin>
>        <groupId>org.apache.cocoon</groupId>
>        <artifactId>cocoon-maven-plugin</artifactId>
>        <version>1.0.0-M2</version>
>        <executions>
>          <execution>
>            <id>prepare</id>
>            <phase>compile</phase>
>            <goals>
>              <goal>prepare</goal>
>            </goals>
>          </execution>
>        </executions>
>        <configuration>
>          <customLog4jXconf>etc/log4j.xml</customLog4jXconf>
>        </configuration>
>      </plugin>
>
> However, I only really care that this happens when I invoke mvn jetty:run
> on the command line.  Otherwise, it's just wasted effort.  I was thinking
> that I could make this into a profile, but I'm not sure how.  Or if that's
> even possible.
>
> Thanks,
> -Dom




-- 
Alexander

Re: Profile activation based on current plugin?

Posted by Dominic Mitchell <do...@semantico.com>.
Sorry — hit send by accident.

On 5 Aug 2009, at 14:43, Dominic Mitchell wrote:

> On 5 Aug 2009, at 14:10, Stephen Connolly wrote:
>
>> if you think about this a bit more you will realise that what you  
>> are asking
>> for does not make sense (unless you are trying to configure the  
>> plugin that
>> you are executing.

Ok…  That does make sense.

>
>> if you specify a plugin:mojo, then only that plugin:mojo will get  
>> executed.
>> Adding other executions of other plugins to a profile and  
>> activating that
>> profile will have ZERO effect on what happens, as only the  
>> plugin:mojo that
>> you specified will be executed.
>>
>
> That's not actually the case.  For jetty:run, it executes all phases  
> up to compile before executing jetty:run.
>

Thinking about this, the jetty plugin must be somehow manually be  
invoking the compile phase.

And if I use help:describe, I see:

   …The plugin forks a parallel lifecycle to ensure that the
     'compile' phase has been completed before invoking Jetty. This  
means that
     you do not need to explicity execute a 'mvn compile' first…

   Before this mojo executes, it will call:
     Phase: 'test-compile'

That explains it.

>> try telling us a bit more about what your problem is and perhaps  
>> somebody
>> can point you towards a solution.... but it sounds like you really  
>> want
>> maven to be more like ant... maven is not ant, if you want ant use  
>> ant ;-)
>
> Sorry, I thought I'd been clearer in my original email.

I'm trying to avoid calling cocoon:prepare, except in the case of  
jetty:run.

Now I could just not bind cocoon:prepare to the compile phase, but  
then I have to remember to type two things on the command line.

It's not a big deal overall (saving seconds on the non-jetty builds)  
but it would be nice if I could do it.

-Dom

Re: Profile activation based on current plugin?

Posted by Dominic Mitchell <do...@semantico.com>.
On 5 Aug 2009, at 14:10, Stephen Connolly wrote:

> if you think about this a bit more you will realise that what you  
> are asking
> for does not make sense (unless you are trying to configure the  
> plugin that
> you are executing.



> if you specify a plugin:mojo, then only that plugin:mojo will get  
> executed.
> Adding other executions of other plugins to a profile and activating  
> that
> profile will have ZERO effect on what happens, as only the  
> plugin:mojo that
> you specified will be executed.
>

That's not actually the case.  For jetty:run, it executes all phases  
up to compile before executing jetty:run.

> try telling us a bit more about what your problem is and perhaps  
> somebody
> can point you towards a solution.... but it sounds like you really  
> want
> maven to be more like ant... maven is not ant, if you want ant use  
> ant ;-)
>


Sorry, I thought I'd been clearer in my original email.

-Dom

> -Stephen
>
> 2009/8/5 Dominic Mitchell <do...@semantico.com>
>
>> Hi all,
>>
>> I'm wondering — is there a way to activate a profile based on the  
>> plugin
>> specified on the command line?
>>
>> The reason for this is that I'm working with a cocoon project.   
>> Normally,
>> the cocoon plugin gets bound to compile:
>>
>>     <plugin>
>>       <groupId>org.apache.cocoon</groupId>
>>       <artifactId>cocoon-maven-plugin</artifactId>
>>       <version>1.0.0-M2</version>
>>       <executions>
>>         <execution>
>>           <id>prepare</id>
>>           <phase>compile</phase>
>>           <goals>
>>             <goal>prepare</goal>
>>           </goals>
>>         </execution>
>>       </executions>
>>       <configuration>
>>         <customLog4jXconf>etc/log4j.xml</customLog4jXconf>
>>       </configuration>
>>     </plugin>
>>
>> However, I only really care that this happens when I invoke mvn  
>> jetty:run
>> on the command line.  Otherwise, it's just wasted effort.  I was  
>> thinking
>> that I could make this into a profile, but I'm not sure how.  Or if  
>> that's
>> even possible.
>>
>> Thanks,
>> -Dom


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


Re: Profile activation based on current plugin?

Posted by Stephen Connolly <st...@gmail.com>.
if you think about this a bit more you will realise that what you are asking
for does not make sense (unless you are trying to configure the plugin that
you are executing.

if you specify a plugin:mojo, then only that plugin:mojo will get executed.
Adding other executions of other plugins to a profile and activating that
profile will have ZERO effect on what happens, as only the plugin:mojo that
you specified will be executed.

try telling us a bit more about what your problem is and perhaps somebody
can point you towards a solution.... but it sounds like you really want
maven to be more like ant... maven is not ant, if you want ant use ant ;-)

-Stephen

2009/8/5 Dominic Mitchell <do...@semantico.com>

> Hi all,
>
> I'm wondering — is there a way to activate a profile based on the plugin
> specified on the command line?
>
> The reason for this is that I'm working with a cocoon project.  Normally,
> the cocoon plugin gets bound to compile:
>
>      <plugin>
>        <groupId>org.apache.cocoon</groupId>
>        <artifactId>cocoon-maven-plugin</artifactId>
>        <version>1.0.0-M2</version>
>        <executions>
>          <execution>
>            <id>prepare</id>
>            <phase>compile</phase>
>            <goals>
>              <goal>prepare</goal>
>            </goals>
>          </execution>
>        </executions>
>        <configuration>
>          <customLog4jXconf>etc/log4j.xml</customLog4jXconf>
>        </configuration>
>      </plugin>
>
> However, I only really care that this happens when I invoke mvn jetty:run
> on the command line.  Otherwise, it's just wasted effort.  I was thinking
> that I could make this into a profile, but I'm not sure how.  Or if that's
> even possible.
>
> Thanks,
> -Dom