How to run a specific target using antrun-plugin from the command line?
To strictly answer this question, you cannot, and you will not.
What you can do either:
1. provide a plugin level configuration
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<configuration>
....
</configuration>
</plugin>
And this configuration will be used when calling the plugin (regardless of how the plugin is called: from cli, part of the life cycle).
2. provide a level of execution configuration(this is what you did)
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>myExecution</id>
<phase>deploy</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<ant target="myTarget" inheritRefs="true">
...
</ant>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
And then call the phase the plugin is bound to ( deployin this case).
3. configuration default-cli
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<tasks>
<ant target="myTarget" inheritRefs="true">
...
</ant>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
Maven 2.2.0 (. MNG-3401), , , POM , Id default-cli. , .
Ant target configuration. , , - , , , Ant.