Customizing Generated Ant Build Files

Warning : If you want to add your own Ant targets, you should add them to build.xml and not to maven-build.xml .

The build.xml file uses the import task of Ant. So, you can override the generated targets in the build.xml file. For instance:

<?xml version="1.0" encoding="UTF-8"?>

<!-- ====================================================================== -->
<!-- Ant build file (http://ant.apache.org/) for Ant 1.6.2 or above.        -->
<!-- ====================================================================== -->

<project name="%PROJECT_ARTIFACT_ID%" default="package" basedir=".">

  <!-- ====================================================================== -->
  <!-- Import maven-build.xml into the current project                        -->
  <!-- ====================================================================== -->

  <import file="maven-build.xml"/>

  <!-- ====================================================================== -->
  <!-- Help target                                                            -->
  <!-- ====================================================================== -->

  <target name="help">
    <echo message="Please run: $ant -projecthelp"/>
  </target>

  <!-- ====================================================================== -->
  <!-- Override the jar target from maven-build.xml                           -->
  <!-- ====================================================================== -->

  <target name="jar">
    <echo message="Nothing to do."/>
  </target>
</project>