The WritePom Task

Note: This task is available since version 2.1.0 of the Maven Ant Tasks

The WritePom task can be used to generate a POM file based on information defined in the Ant build. For example, this could be used to generate a POM used when deploying build artifacts to a Maven repository.

The first step is to define a pom using the pom task.

  <artifact:pom id="mypom1" groupId="org.acme" artifactId="project1" version="1.0" name="My awesome project">
    <license name="apache" url=""/>
    <dependency groupId="junit" artifactId="junit" version="4.1" scope="test"/>
    <dependency groupId="org.codehaus.plexus" artifactId="plexus-utils" version="1.5.5"/>

The next step is to call the writePom task using the pom id created above.

  <artifact:writepom pomRefId="mypom1" file="target/mypom1.xml"/>

This will generate a pom in the location specified.

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="" xmlns=""


  <name>My awesome project</name>



By default the writePom task will not include unnecessary information such as build configuration, repositories, and profiles. If this information is needed in the pom, the "trim" option can be set to false.

  <artifact:writepom pomRefId="mypom1" file="target/mypom1.xml" trim="false"/>