蚂蚁:如何比较两个文件的内容 [英] ant: how to compare contents of two files

查看:137
本文介绍了蚂蚁:如何比较两个文件的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要比较两个文件的内容(比如FILE1.TXT,FILE2.TXT)使用ANT。

I want to compare the contents of two files (say file1.txt,file2.txt) using ANT.

如果文件中的内容相同那么就应该设置一些财产为true,如果内容不一样的话,应该设置财产为假。

if files content are same then it should set some 'property' to true, if contents are not same then it should set the 'property' as false.

任何人都可以给我建议任何Ant任务可以做到这一点。

Can anyone suggest me any ANT task that can do this.

先谢谢了。

推荐答案

您可以使用这样的:

<condition property="property" value="true">
  <filesmatch file1="file1"
              file2="file2"/>
</condition>

这将设置该属性只有当文件是相同的。
然后,您可以检查该属性,使用

This will set the property only if the files are the same. You can then check for the property, using

<target name="foo" if="property">
...
</target>

这是在蚂蚁提供,无添加的依赖,请参见这里其他条件。

This is available in ant, with no added dependency, see here for other conditions.

这篇关于蚂蚁:如何比较两个文件的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆