Can we use pom.xml into ANT

Sachchidanand picture Sachchidanand · Sep 26, 2011 · Viewed 7.7k times · Source

I know that, we can very well use ANT and Maven together to build the project.We can run ANT scripts through Maven's POM.xml. But my question is can we run pom.xml through ANT's build.xml ? i.e. can we create maven build from build.xml

Answer

Raghuram picture Raghuram · Sep 26, 2011

Yes, using maven ant tasks.

The page lists out multiple maven tasks which can be integrated into an ant build script, thus combining the features of both. To take an example, there is the mvn task, which as documented can do a full maven build from ant.

  <artifact:mvn mavenHome="/path/to/maven-3.0.x">
     <arg value="install"/>
  </artifact:mvn>

Besides this, there are

  • Dependencies task
  • Install and Deploy tasks
  • Pom task

each described with examples.