I want to compare the contents of two files (say file1.txt,file2.txt) using ANT.
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.
Can anyone suggest me any ANT task that can do this.
Thanks in advance.
Go to file name in project then press control then select Compare File and select another file you wish to compare. Seperate window will open up showing differences by colour contrast. Welcome to SO !
You can use something like:
<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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With