I have a problem with my ant script. basically i want to read a property and compare it with a string.
<property name="server_environment" value="local"/>
...
<condition property="blabla2">
<equals arg1="local" arg2="local" trim="true" forcestring="true"/>
</condition>
<condition property="blabla">
<equals arg1="{$server_environment}" arg2="local" trim="true" forcestring="true"/>
</condition>
Now in the output we get (after turning -debug on)
Setting project property: server_environment -> local
...
Condition true; setting blabla2 to true
Setting project property: blabla2 -> true
Condition false; not setting blabla
I do not understand why blabla evaluates to false here. Perhaps something is going wrong when reading the server_environment property. But i am not sure what.
Apparantly i needed to change to position of the $. I changed
<equals arg1="{$server_environment}" arg2="local" trim="true" forcestring="true"/>
Into
<equals arg1="${server_environment}" arg2="local" trim="true" forcestring="true"/>
Now it does set the property correctly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.