如何在ant里import

http://hi.baidu.com/fangpw/blog/item/78cfe7fcf7988a8cb801a0ec.html

    <!--[endif]-->Import

<antcall>和<marcodef>可以达到类似函数的效果,但是调用者和被调用者还是必须在同一个文件中。Ant从1.6开始引入Import Task,可以真正的实现代码重用:属性,Task 定义,Task, Macro。一个简单的例子:

common.xml:

<?xml version="1.0" ?>

<project>

       <property name="project.name" value="Ant Modulazation" />

       <target name="commonTarget">

              <echo message="${test.param}" />

       </target>

      

       <macrodef name="showModule">

            <attribute name="test.param" default="NOT SET"/>

            <sequential>

                 <echo message="@{test.param}" />

            </sequential>

       </macrodef>

</project>

call.xml:

<?xml version="1.0" ?>

<project name="testCommon" default="callingTarget">

       <import file="common.xml" />

      

       <target name="callingTarget">

              <antcall target="commonTarget">

                     <param name="test.param" value="Modulation" />

              </antcall>

       </target>

       <target name="testMacro">

              <showModule test.param="Modulation" />

       </target>

</project>

原文地址:https://www.cnblogs.com/balaamwe/p/2383385.html