繁体   English   中英

每次使用不同的属性文件多次运行Ant

[英]Run Ant multiple times using a different property file each time

我有一个使用属性文件作为输入的Ant项目:

  1. 检索特定的RSS feed并将其存储
  2. 通过多个目标,使用XSL最终输出XML API调用。

该属性文件不仅具有要获取的特定提要,还具有API调用所需的其他8个文本和日期值。

Ant + XSL解决方案效果很好,而且速度很快。

问题:我有8个不同的属性文件。 我想运行一次Ant(现在为cmd行),并让Ant遍历整个目标集8次,每个属性文件作为输入一次。

最佳的Ant方法是什么?

谢谢!

您可以使用<ant>任务来执行具有不同属性的构建。 配置一个目标,该目标执行所有8种不同的ant运行,然后运行该目标。 像这样:

ant runAll

将为加载的特定属性文件执行“运行”目标8次不同的时间。

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="" default="run">
  <target name="runAll">
      <ant inheritAll="false">
          <property file="file1.properties"/>
      </ant>
      <ant inheritAll="false">
          <property file="file2.properties"/>
      </ant>
      <ant inheritAll="false">
          <property file="file3.properties"/>
      </ant>
      <ant inheritAll="false">
          <property file="file4.properties"/>
      </ant>
      <ant inheritAll="false">
          <property file="file5.properties"/>
      </ant>
      <ant inheritAll="false">
          <property file="file6.properties"/>
      </ant>
      <ant inheritAll="false">
          <property file="file7.properties"/>
      </ant>
      <ant inheritAll="false">
          <property file="file8.properties"/>
      </ant>
  </target>
    <target name="run">
        <echo message="running..."/>
    </target>
</project>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM