Age*_*opf 6 ant comparison conditional
我有一个ant任务,它应该比较两个值的相等性.如果这两个值不相等,我想失败:
<condition property="versionDoesNotMatch">
<not>
<equals arg1="applicationVersion" arg2="releaseNotesVersion"/>
</not>
</condition>
<fail if="versionDoesNotMatch" message="Version of Application and Release notes does not match."/>
Run Code Online (Sandbox Code Playgroud)
根据ant输出,两个值,releaseNotesVersion和applicationVersion具有相同的值1.7但条件总是计算为true - 由于not意味着数字不相等.这让我想知道,如果蚂蚁比较这些价值观会有麻烦吗?
gar*_*les 16
您在示例中匹配两个文字字符串; 这些永远不会是平等的,所以你的条件总是评估为真.假设您的args是Ant属性,您需要像这样评估属性值:
<condition property="versionDoesNotMatch">
<not>
<equals arg1="${applicationVersion}" arg2="${releaseNotesVersion}"/>
</not>
</condition>
<fail if="versionDoesNotMatch" message="Version of Application and Release notes does not match."/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21097 次 |
| 最近记录: |