Same plugin, different phases

View: New views
5 Messages — Rating Filter:   Alert me  

Same plugin, different phases

by Gajo Csaba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I use the exec plugin, and I need to pass it different parameters based
on the target I define. So for example, if I write mvn test, then exec
should forward one set of arguements to the command it executes, and if
I write mvn compile, then it sends another arguement. How to do this?

I though about writing the <plugin> definition twice, one with <phase>
test, and another with compile, and writing two different
<configuraiton>s, but this didn't work, only the first config is
executed in both cases.

Is there a way to do this or I need to write my own plugin?

Thanks, Csaba



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


Re: Same plugin, different phases

by Anders Hammar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Most likely you've put the configuration element wrong. It should be inside
the execution section.

/Anders

2009/11/4 Gajo Csaba <csaba.gajo@...>

> Hello,
>
> I use the exec plugin, and I need to pass it different parameters based on
> the target I define. So for example, if I write mvn test, then exec should
> forward one set of arguements to the command it executes, and if I write mvn
> compile, then it sends another arguement. How to do this?
>
> I though about writing the <plugin> definition twice, one with <phase>
> test, and another with compile, and writing two different <configuraiton>s,
> but this didn't work, only the first config is executed in both cases.
>
> Is there a way to do this or I need to write my own plugin?
>
> Thanks, Csaba
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>

Re: Same plugin, different phases

by Gajo Csaba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If I put the configuration element inside the execution element, I get
an error saying that it needs to be inside the plugin element. This is
what I've tried:

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.1</version>
        <executions>
          <execution>
                <phase>test</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>echo</executable>
              <workingDirectory>/home/cgajo/tmp/protest</workingDirectory>
              <arguments>
                 <argument>"aaa"</argument>
                 <argument>></argument>
                 <argument>out.txt</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>




Anders Hammar wrote:

> Most likely you've put the configuration element wrong. It should be inside
> the execution section.
>
> /Anders
>
> 2009/11/4 Gajo Csaba <csaba.gajo@...>
>
>  
>> Hello,
>>
>> I use the exec plugin, and I need to pass it different parameters based on
>> the target I define. So for example, if I write mvn test, then exec should
>> forward one set of arguements to the command it executes, and if I write mvn
>> compile, then it sends another arguement. How to do this?
>>
>> I though about writing the <plugin> definition twice, one with <phase>
>> test, and another with compile, and writing two different <configuraiton>s,
>> but this didn't work, only the first config is executed in both cases.
>>
>> Is there a way to do this or I need to write my own plugin?
>>
>> Thanks, Csaba
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>>    
>
>  


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


Re: Same plugin, different phases

by Jörg Schaible-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Csaba,

Gajo Csaba wrote at Mittwoch, 4. November 2009 13:29:

> Hello,
>
> I use the exec plugin, and I need to pass it different parameters based
> on the target I define. So for example, if I write mvn test, then exec
> should forward one set of arguements to the command it executes, and if
> I write mvn compile, then it sends another arguement. How to do this?
>
> I though about writing the <plugin> definition twice, one with <phase>
> test, and another with compile, and writing two different
> <configuraiton>s, but this didn't work, only the first config is
> executed in both cases.

You cannot define the same plugin twice.

> Is there a way to do this or I need to write my own plugin?

You have to define multiple executions with own configurations.

- Jörg


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


Re: Same plugin, different phases

by Gajo Csaba :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ah ok, got it to work. Looks like I needed to define a global execution
as well

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