自定义生成的 Ant 构建文件

警告:如果您想添加自己的 Ant 目标,您应该将它们添加到build.xml不是maven -build.xml

build.xml文件使用 Ant 的导入任务。因此,您可以覆盖build.xml文件中生成的目标。例如:

<?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>