我有一个执行过滤器副本的 ant 任务,我多次调用它只更改参数。这是为各种环境创建属性文件。
我想简化调用目标,这样我就可以做更少的复制和粘贴。
这是调用目标
<target name="create_local_property_files" depends="clean,prepare">
<!-- create first machine property files -->
<antcall target="property.filter.copy" inheritAll="false">
<param name="tmp.dom" value="machine1" />
</antcall>
<!-- create second machine property files -->
<antcall target="property.filter.copy" inheritAll="false">
<param name="tmp.dom" value="machine2" />
</antcall>
[...] <!-- to the n'th machine property file -->
</target>
我想打一个电话并传递一份机器列表。有什么建议么?
这是完整的过滤器副本目标
<target name="property.filter.copy">
<copy todir="${local.property.file.dir}" failonerror="true" verbose="true" overwrite="true">
<filterset>
<!-- Uses the same filters files as scripts -->
<filtersfile file="${property.variables.dir}/${tmp.dom}.properties" />
</filterset>
<fileset dir="${property.file.dir}">
<include name="cnmp.properties" />
<include name="cnmp.jdo.properties" />
</fileset>
<!-- Deployment script looks for hostname.rest_of_filename-->
<globmapper from="*" to="${tmp.dom}.*" />
</copy>
</target>