You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Chris <sh...@yahoo.com> on 2009/09/25 23:04:52 UTC

How to throw error if two files not equal?

I need to check to see if two files are the same, and throw an error and 
stop the build if they're not.

Two problems:

How to throw an error?
How to compare two files?

This is as far as I've gotten:

<condition property="isgood">
   <filesmatch file1="file1.xml" file2="file2.xml"/>
</condition>
<echo>${isgood}</echo>

This works, sort of, but it doesn't throw an error. Bizarrely, if 
neither file exists it returns true.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: How to throw error if two files not equal?

Posted by Ja...@rzf.fin-nrw.de.
<antunit:assertFilesMatch>
http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/docs/assertions.html?view=co
http://ant.apache.org/antlibs/antunit/index.html

Jan 

> -----Ursprüngliche Nachricht-----
> Von: news [mailto:news@ger.gmane.org] Im Auftrag von Chris
> Gesendet: Freitag, 25. September 2009 23:05
> An: user@ant.apache.org
> Betreff: How to throw error if two files not equal?
> 
> I need to check to see if two files are the same, and throw 
> an error and 
> stop the build if they're not.
> 
> Two problems:
> 
> How to throw an error?
> How to compare two files?
> 
> This is as far as I've gotten:
> 
> <condition property="isgood">
>    <filesmatch file1="file1.xml" file2="file2.xml"/>
> </condition>
> <echo>${isgood}</echo>
> 
> This works, sort of, but it doesn't throw an error. Bizarrely, if 
> neither file exists it returns true.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: How to throw error if two files not equal?

Posted by Dominique Devienne <dd...@gmail.com>.
On Fri, Sep 25, 2009 at 4:04 PM, Chris <sh...@yahoo.com> wrote:
> [...] and throw an error

See the <fail> task. --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org