I would like to clarify the if and unless statements in ANT script
I have the following code:
<condition property="hasExtensions">
<contains string="${Product_version}" substring="Extensions">
</condition>
<exec executable="${TrueCM_App}\ssremove.exe" unless="hasExtensions">
...
</exec>
Does that mean the above <exec> would execute ssremove.exe if Product_version does not contain the string "Extensions"?
Then how about the opposite case: if it contains the string "Extensions"? Will my code look like this:
<condition property="hasExtensions">
<contains string="${Product_version}" substring="Extensions">
</condition>
<!-- here below it does not have the string "Extensions" -->
<exec executable="${TrueCM_App}\ssremove.exe" unless="hasExtensions">
...
</exec>
<!-- below is for if it has the string "Extensions" -->
<exec executable="${TrueCM_App}\ssremove.exe" if="hasExtensions">
...
</exec>
You’ve got the logic right, but I’m not sure that the
<exec>task accepts theifandunlessattributes. See the docs for more info.You will probably need to wrap the
<exec>tasks in a target that checks the condition. For example:Then if you run
ant ssremoveI think you will get what you want.