你怎么检查一个数字属性少于Apache Ant?
<property name="small" value="15"/>
<property name="big" value="156"/>
<fail message="small is less than big!">
<condition>
<lessthan val1="${small}" val2="${big}"/>
</condition>
</fail>
Run Code Online (Sandbox Code Playgroud)
从我所看到的(我是Ant的新手)你只能这样做<equal/>?
您可以使用<scriptcondition>(请参阅http://ant.apache.org/manual/Tasks/conditions.html)。
仔细阅读文档,因为它需要在 ant 中安装额外的 jar 依赖项。
条件可能看起来像这样(未经测试):
<scriptcondition language="javascript">
var small = parseInt(project.getProperty("small"));
var big = parseInt(project.getProperty("big"));
self.setValue(small < big);
</scriptcondition>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6364 次 |
| 最近记录: |