Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute maven plugin execution directly from command line?

Tags:

maven-2

maven

I have a plugin (antrun) with an execution configured which has an id and is not bound to any phase. Can I execute this execution directly from the command line?

<plugin>   <artifactId>maven-antrun-plugin</artifactId>   <executions>     <execution>       <id>my-execution</id>       ...     </execution>   </executions> </plugin> 

An run it with something like:

mvn my-execution 

or at least

mvn magicplugin:execute -DexecutionId=my-execution 
like image 758
artemb Avatar asked Jul 02 '10 14:07

artemb


People also ask

What is the command for Maven build?

To build a Maven project via the command line, you use the mvn command from the command line. The command must be executed in the directory which contains the relevant pom file. You pass the build life cycle, phase or goal as parameter to this command.

Where do plugins go in POM XML?

Build plugins They execute during the build process and should be configured in the <build/> element of pom. xml.


1 Answers

This functionality has been implemented as MNG-5768, and is available in Maven 3.3.1.

The change will:

extend direct plugin invocation syntax to allow optional @execution-id parameter, e.g., org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process@executionId.

So, in your case:

mvn antrun:run 

uses the default-cli execution ID, and:

mvn antrun:run@my-execution 

uses the execution configured in your pom.

like image 111
Joe Avatar answered Sep 24 '22 07:09

Joe