I have the following in my pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ant-plugin</artifactId>
<version>2.3</version>
<configuration>
<target>
<echo
message="hello ant, from Maven!" />
<echo>Maybe this will work?</echo>
</target>
</configuration>
</plugin>
Yet, when I run 'mvn antrun:run' I get this:
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'antrun'.
[INFO] ------------------------------------------------------------------------
[INFO] Building myProject
[INFO] task-segment: [antrun:run]
[INFO] ------------------------------------------------------------------------
[INFO] [antrun:run {execution: default-cli}]
[INFO] Executing tasks
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Fri Sep 24 13:33:14 PDT 2010
[INFO] Final Memory: 16M/28M
[INFO] ------------------------------------------------------------------------
How come the echo's don't show up?
TIA
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.
You can use the maven-antrun-plugin to invoke the ant build. Then use the build-helper-maven-plugin to attach the jar produced by ant to the project. The attached artifact will be installed/deployed alongside the pom. If you specify your project with packaging pom , Maven will not conflict with the ant build.
Because you are supposed to use the Maven AntRun Plugin if you want to execute Ant tasks, not the Maven Ant Plugin (which is used to generate build files for Ant 1.6.2 or above from the POM). Modify your plugin configuration as below:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.5</version>
<configuration>
<target>
<echo message="hello ant, from Maven!"/>
<echo>Maybe this will work?</echo>
</target>
</configuration>
</plugin>
And invoking antrun:run
will work:
$ mvn antrun:run [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Q3790798 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-antrun-plugin:1.5:run (default-cli) @ Q3790798 --- [INFO] Executing tasks main: [echo] hello ant, from Maven! [echo] Maybe this will work? [INFO] Executed tasks [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ ...
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