I may not have explained what I did very well... I have a base target that is like this:
<target name="build"> <antcall target="startup_details" /> <antcall target="stop_tomcat" /> <antcall target="pre_cleanup" /> <antcall target="compile_app" /> <antcall target="update_system_about" /> ... </target> There's probably 10-15 more where you see the ... All the called targets are within the same build script. One of the targets that gets called from the build target is like: <target name="tomcat_dev" if="app_mode_dev"> >From within that, I have; <antcall target="tomcat_dev_conf"> ..which calls the target: <target name="tomcat_dev_conf" if="use_tomcat"> So, as I commented before, it winds up being like a nested if... the tomcat_dev_conf target will only execute if the tomcat_dev target does, and then only if the use_tomcat property is defined. This is what I needed because the script can build the app in dev, STest, ATest or prod mode, which means a different tomcat_xxx target being called, but in addition you can actually say that Tomcat isn't being used at all (the script builds for Tomcat and Websphere because of some minor differences)... when Tomcat isn't used, the tomcat_xxx target still should execute because what it does doesn't actually *depend* om Tomcat, whereas the tomcat_dev_conf target *does*. A bit convoluted maybe, but it actually works extremely well for me. Fortunately, I don't have the notion of returning values anywhere (I've never done that, I'd have to look up how frankly!), so that isn't a concern. Does if really spawn a whole new project instance? I wasn't aware of that... I wonder if that's true if the targets are all in the same script? -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Fri, June 24, 2005 11:09 am, [EMAIL PROTECTED] said: > I wouldnt use <antcall> for checking the properties - it creates a new > project instance > (I call that property-namespace :) and it´s difficult to return values. > > Jan > >>-----Ursprüngliche Nachricht----- >>Von: Frank W. Zammetti [mailto:[EMAIL PROTECTED] >>Gesendet: Freitag, 24. Juni 2005 15:32 >>An: Ant Users List >>Cc: user@ant.apache.org >>Betreff: Re: AW: Multiple IFs, or IFs on tasks >> >>Thank you Jan, that's a good approach too. >> >>FYI, I wound up taking a simple approach, after I thought >>about this some more... I simply have an antcall from one >>target to another that checks the second property. So it >>winds up being like a nested if in a sense... >>I would have to explain quite a bit to be able to explain why >>this worked in my case, but suffice it to say it does :) >> >>Thanks everyone, I appreciate all the suggestions! >> >>-- >>Frank W. Zammetti >>Founder and Chief Software Architect >>Omnytex Technologies >>http://www.omnytex.com >> >>On Fri, June 24, 2005 1:04 am, [EMAIL PROTECTED] said: >>> Common pattern: >>> >>> >>> <target name="do" depends="-do.check" if="do.condition"> >>> <echo>All conditions set</echo> >>> </target> >>> >>> <target name="-do.check"> >>> <condition property="do.condition"> >>> ... >>> </condition> >>> </target> >>> >>> >>> Jan >>> >>> >>>>-----Ursprüngliche Nachricht----- >>>>Von: Frank W. Zammetti [mailto:[EMAIL PROTECTED] >>>>Gesendet: Donnerstag, 23. Juni 2005 17:42 >>>>An: Ant Users List >>>>Cc: Ant Users List >>>>Betreff: Re: Multiple IFs, or IFs on tasks >>>> >>>>Ah, thank you Ninju! I wasn't aware of the <condition> >>task, I think >>>>that will do the trick. One extra step, but not a hassle. >>>> >>>>By the way, your name is only one letter off from ultimate coolness, >>>>but I'm sure you know that already :) >>>> >>>>-- >>>>Frank W. Zammetti >>>>Founder and Chief Software Architect >>>>Omnytex Technologies >>>>http://www.omnytex.com >>>> >>>>On Thu, June 23, 2005 11:38 am, Ninju Bohra said: >>>>> Correct on both counts, >>>>> >>>>> For the first one, you may want to use a <condition> task to >>>>"consolidate" >>>>> all the individual flags into one property which you use >>in the if="" >>>>> attribute. >>>>> >>>>> As for the second, it is touch-and-go as to which tasks have an >>>>> if/unless attribute (i.e. some have them and some don't). >>The fail >>>>> task is one that comes to mind that has both but these >>>>attributes are >>>>> not "generic" to all tasks (there have numerous discussion on this >>>>> already, but to no avail :-( >>>>> >>>>> "Frank W. Zammetti" <[EMAIL PROTECTED]> wrote: >>>>> Hi all... I'm trying to solve a problem and one of the >>following two >>>>> approaches would work, and although it doesn't seem >>possible from my >>>>> testing, I wanted to run it by you guys... >>>>> >>>>> First, is it possible to do if checks on a target against multiple >>>>> properties? I tried simply have two if attributes, but >>that threw an >>>>> error, and I tried a comma-separated list within a single >>>>if, but that >>>>> resulted in the task not executing. >>>>> >>>>> Second, I might be missing it, but there doesn't seem to be an if >>>>> attribute on a task (like copy for instance), is that correct? >>>>> >>>>> Thanks all! >>>>> >>>>> -- >>>>> Frank W. Zammetti >>>>> Founder and Chief Software Architect Omnytex Technologies >>>>> http://www.omnytex.com >>>>> >>>>> >>-------------------------------------------------------------------- >>>>> - To unsubscribe, e-mail: [EMAIL PROTECTED] For >>>>additional >>>>> commands, e-mail: [EMAIL PROTECTED] >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> __________________________________________________ >>>>> Do You Yahoo!? >>>>> Tired of spam? Yahoo! Mail has the best spam protection around >>>>> http://mail.yahoo.com >>>> >>>> >>>>--------------------------------------------------------------------- >>>>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] >> >> > > --------------------------------------------------------------------- > 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]