I'm using Maven AntRun plugin 1.6 and from their example I cannot code the following ant task to be executed.
Example url: http://maven.apache.org/plugins/maven-antrun-plugin/examples/classpaths.html
I just get the following message when I execute mvn antrun:run. No ant target defined - SKIPPED
What am I doing wrong?
Here's my POM:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<configuration>
<target>
<property name="compile_classpath" refid="maven.compile.classpath" />
<property name="runtime_classpath" refid="maven.runtime.classpath" />
<property name="test_classpath" refid="maven.test.classpath" />
<property name="plugin_classpath" refid="maven.plugin.classpath" />
<echo message="compile classpath: ${compile_classpath}" />
<echo message="runtime classpath: ${runtime_classpath}" />
<echo message="test classpath: ${test_classpath}" />
<echo message="plugin classpath: ${plugin_classpath}" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
This plugin provides the ability to run Ant tasks from within Maven. You can even embed your Ant scripts in the POM! It is not the intention of this plugin to provide a means of polluting the POM, so it's encouraged to move all your Ant tasks to a build.
Description: Maven AntRun Mojo. This plugin provides the capability of calling Ant tasks from a POM by running the nested Ant tasks inside the <target/> parameter. It is encouraged to move the actual tasks to a separate build. xml file and call that file with an <ant/> task.
try this
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<target>
<property name="compile_classpath" refid="maven.compile.classpath" />
<property name="runtime_classpath" refid="maven.runtime.classpath" />
<property name="test_classpath" refid="maven.test.classpath" />
<property name="plugin_classpath" refid="maven.plugin.classpath" />
<echo message="compile classpath: ${compile_classpath}" />
<echo message="runtime classpath: ${runtime_classpath}" />
<echo message="test classpath: ${test_classpath}" />
<echo message="plugin classpath: ${plugin_classpath}" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
note the id
<id>default-cli</id>
and run the command
mvn antrun:run
reason for doing this way: if you don't actually want to "compile", running "mvn compile" to execute something else could be counter productive.
Since you have configured the maven antrun plugin in your pom.xml
, you only need to call the lifecycle goal configured for the plugin. In this case
mvn compile
This will do the needful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With