tags:

views:

152

answers:

2

How can I stop a build, and notify the user if a file does not exist? I know I can use the available task to set a property if a file exists, but I'm not sure how I would stop a build and echo something.

I would like to stick with core tasks if possible.

Thanks.

+6  A: 

You can use the fail task http://ant.apache.org/manual/CoreTasks/fail.html for all your failing needs. The last example on that page is actually pretty much what you need

<fail message="Files are missing.">
    <condition>
        <not>
            <resourcecount count="2">
                <fileset id="fs" dir="." includes="one.txt,two.txt"/>
            </resourcecount>
        </not>
    </condition>
</fail>
stimms
Amazing how there is always another task that I have never heard about. Thanks.
Steve
+3  A: 

Set your property and use the Fail task with the if attribute.

Jason Punyon