In my previous entries, Accessing Maven dependencies through Ant: Part 1 and Part 2 , I had been talking about how we can explore Maven dependencies from Ant. Here, we will talk about how we can do the reverse, that is, invoke Ant from within Maven. I guess this is the more common scenario of the two. Often we have encountered a legacy project which has Ant as the build tool, and we need to integrate that with Maven, often invoking the Ant's build file from pom.xml. We will continue using our RMI Sever as an example.
We will actually use the Idiot's paradigm © to demonstrate how to invoke Ant through Maven.
Is pretty straight forward. I have created a Profile called AetherAntTaskExample, which looks like:
AetherAntTaskExample org.apache.maven.plugins maven-antrun-plugin 1.7 package run
You invoke this by doing:
mvn clean package -P AetherAntTaskExample
The ant file is invoked and executed. The original pom.xml can be found here.