Ant in Action读书笔记(四):如何在Ant里对numberic的property进行比较?

The Ant script task allows you to implement a task in a scripting language. If you have JDK 1.6 installed, Ant can execute JavaScript without needing any additional dependent libraries. For example, this JavaScript reads an Ant property value and then sets another Ant property depending on a condition:

 

<target name="init">
  <property name="version" value="2"/>
  <script language="javascript"><![CDATA[
    var version = parseInt(project.getProperty('version'));
    project.setProperty('isGreater', version > 1);
  
]]></script>

  <echo message="${isGreater}"/>
</target>
posted @ 2012-11-03 07:29  卜海清  阅读(208)  评论(0编辑  收藏  举报