Ant: macrodef

<macrodef name="tokenReplace">
    <attribute name="subapp"/>
    <attribute name="targetFile"/>
    <sequential>
        <echo>Replacing tokens in file @{targetFile}</echo>
        <replace file="@{targetFile}" encoding="utf-8">
            <replacefilter token="@subapp@" value="${subapp}"/>
        </replace>
        <exec executable="chown">
            <arg value="uc9usr:tcgroup"/>
            <arg value="@{targetFile}"/>
        </exec>
    </sequential>
</macrodef>
 ...
<target name="xxx">
    ...
    <tokenReplace subapp="ifmmanage" targetFile="${tc.app.webroot.ifmmanage}/ifmmanage.xml"/>
</target>

https://ant.apache.org/manual/Tasks/replace.html

猜你喜欢

转载自www.cnblogs.com/chenjo/p/13406320.html
ANT