Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant warning/failure when file / build.properties is missing?

My teams ant task pulls in developer specific info from a build.properties file by using the property file tag:

<property file="${user.home}/build.properties.txt" />

However, when this file is missing ant continues regardless. Later on in the build process it then tries to access properties that have not been defined and tries to log into the svn server as ${user.name} and other similar errors. These errors were quite difficult to debug, as some of the ant tasks I used did not give useful error messages.

My primary question is: Is there a way to ask ant to fail-fast if it cannot find the properties file?

like image 790
Ben Page Avatar asked Nov 28 '22 18:11

Ben Page


1 Answers

I think you can combine available and fail:

Sets the property if File is present

<available file="${user.home}/build.properties.txt" property="build.properties.present"/>

Fails if property is not set

<fail unless="build.properties.present"/>
like image 110
oers Avatar answered Dec 06 '22 09:12

oers