To avoid the procedural logic you could have done the following: <target name="relcheck"> <!-- put whatever code here to set the release_candidate property to any value. --> </target>
<target name="release" depends="relcheck" if="release_candidate"> <!-- mail stuff goes here. --> </target> This is more within the philosophy/architecture of Ant. Bill -----Original Message----- From: Rich Harris [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 22, 2005 11:10 AM To: Ant Users List Subject: RE: Conditions Thanks David. I set this up and worked like a charm: <if> <equals arg1="${release_candidate}" arg2="true" /> <then> <mail mailhost="mail.xxxx.com" subject="The ${component} release candidate build is now available!"> <from address="build01"/> <replyto address="[EMAIL PROTECTED]"/> <to address="[EMAIL PROTECTED]"/> <message> The ${component} release candidate build is now available! Please rsync to: ${deploy.system} ${deploy.path}/${version}.war </message> <fileset file="${this.archive}/log/build.log"/> </mail> </then> </if> -Rich -----Original Message----- From: David Resnick [mailto:[EMAIL PROTECTED] Sent: Monday, March 21, 2005 9:37 PM To: 'Ant Users List' Subject: RE: Conditions The only action a condition task performs is set a property if the condition is true. You can then use the property you have set/not set to be the condition for a separate target (using the if or unless attribute of the target). If you want an if statement, you can find a task that works as one in the ant-contrib tasks. http://ant-contrib.sourceforge.net/tasks/tasks/if.html THT, David -----Original Message----- From: Rich Harris [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 22, 2005 04:57 To: Ant Users List Subject: Conditions So I'm trying to execute the mail task based on a conditional statement. I'm not sure if I'm doing this incorrectly or not. Basically, what I want out of this target is to send an email if the value of a property in my props file is true (yes it is in fact in my props file and my props file is referenced in my XML file :-) ) If I set "release_candidate=true" in my props file, it sends the email, if it's set to false, it sends the email. I think it's user error on my part in understanding how the condition task is used. Any help is appreciated. Here's my code: <target name="release"> <condition property="${release_candidate}"> <istrue value="true"/> </condition> <mail mailhost="mail.XXXX.com" subject="The ${component} release candidate build is now available!"> <from address=" [EMAIL PROTECTED]"/> <replyto address="[EMAIL PROTECTED]"/> <to address="[EMAIL PROTECTED]"/> <message> The ${component} release candidate build is now available! </message> </mail> </target> Thx -Rich _____________________________________ Rich Harris Release/Configuration Engineer --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
