Multiple Maven Execution Configurations maven-exec-plugin

Can I call the execution of the maven-exec-plugin (or any other plugin) with my identifier from the command line?

Let's say the pom.xml file looks like this:

<project> [...] <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <executions> <execution> <id>foo</id> <goals> <goal>exec</goal> </goals> <phase></phase> <configuration> <executable>echo</executable> <arguments> <argument>foo</argument> </arguments> </configuration> </execution> <execution> <id>bar</id> <goals> <goal>exec</goal> </goals> <phase></phase> <configuration> <executable>echo</executable> <arguments> <argument>bar</argument> </arguments> </configuration> </execution> </executions> </plugin> [...] </project> 

Now you can call

mvn exec: exec

with added magic to run "foo" execution?

For the curious, there is an alternative solution using the profiles available here: http://www.mail-archive.com/user@mojo.codehaus.org/msg00151.html

+28
maven maven-2
Feb 03 '10 at 14:37
source share
4 answers

No, It is Immpossible. Executions are intended to be bound to the life cycle (i.e., they are not intended to be invoked on the command line). Therefore, you will have to use the profile trick described in the link you provided.

+15
Feb 03 '10 at 17:53
source share

Now it's possible starting with Maven 3.3.1: see the MNG-5768 improvement and Maven 3.3.1 release notes

You can invoke a specific execution configuration using this syntax:

 mvn exec:exec@foo 
+20
Jul 10 '15 at 10:21
source share

It is not mentioned here that with Maven 2.2.0, if you give the execution of any plugin id "default-cli" , then when you run this plugin from the command line, this configuration is used. You are limited to only one default execution of each plugin, but this is the beginning.

+11
Aug 16 2018-11-21T00:
source share

I think if you write the fulfillment of a goal:

 org.codehaus.mojo:exec-maven-plugin:¿Version?:exec 

it worked for me in the eclipse maven plugin.

0
Aug 16 '11 at 10:12
source share



All Articles