I wanted to check if a property value has a value which is supposed to be read from another file in ant
can any body please without an additional jar.
<property name="a" value="${input.password}" />
wanted to check if input.password has got the value or not from xyz.properties file or not
many thanks Jib
P.S: Actually I have to check this line password=mypassword is exist in .properties file or not with ant script. Another way is welcome !
Edit: I am doing from one of the referenced solutions but not succeeding:
<property file="..\..\xyz\application.properties" prefix="input" />
<property name="foo" value="${input.password}"/>
<fail message="Property "foo" has no value">
<condition>
<not>
<equals arg1="${foo}" arg2=""/>
</not>
</condition>
</fail>
Always getting this message:"Property "foo" has no value" regardless of this line exists or not:password=de in application properties.
you can try using the <fail message="db.schema is not defined!" unless="db.schema"/>
block this for example will fail if db.schema is not defined. You might find some of this and useful, is this what you're looking for?
Check this too. Oh OK I see what you mean now, please try this (I'm using Ant 1.8.2): this is build.xml :
<project name="Bla" default="build" basedir=".">
<target name="build">
<property file="bla.properties"/>
<fail>
<condition>
<not>
<equals arg1="${foo}" arg2="bodo"/>
</not>
</condition>
</fail>
</target>
</project>
The file bla.properties contains foo=boo
, and it currently fails, if I change bodo
to boo
, is succeeds.