如何构建build.xml文件以运行bat文件或shell脚本

时间:2014-04-17 09:15:28

标签: shell unix batch-file ant antbuilder

我有一个bat文件和shell脚本,它执行相同的操作。现在我创建了一个ant build.xml文件,该文件将执行shell脚本或bat文件。我应该如何编写build.xml或如何配置它?

1 个答案:

答案 0 :(得分:0)

选项1:使用条件目标

<condition property="windowsos">
  <os family="windows" />
</condition>

<condition property="linuxos">
  <os family="unix" />
</condition>

<target name="go" depends="go-windows,go-linux"/>

<target name="go-windows" if="windosos">
..
..
</target>

<target name="go-linux" if="windosos">
..
..
</target>

选项2:使用条件执行任务

<target name="go">
  <exec executable="doSomthing.exe" osfamily="windows"/>

  <exec executable="doSomthing" osfamily="unix"/>
</target>
相关问题