tags:

views:

4

answers:

1

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
A: 

What you're looking for is captured in Default+Plugin+Execution+IDs but to my knowledge currently not supported. However, according to the comments of MNG-3401 (read them until the end):

for mojos invoked directly from the command line, you can supply configuration from the POM using the executionId: 'default-cli' like this:

<plugin>
  <artifactId>maven-assembly-plugin</artifactId>
  <executions>
    <execution>
      <id>default-cli</id>
      <configuration>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
          <descriptorRef>project</descriptorRef>
        </descriptorRefs>
      </configuration>
    </execution>
  </executions>
</plugin>

This should work in Maven 2.2.0 and 3.x.

Maybe this will be enough for you.

Pascal Thivent