OK. I think I understand what you are trying to do. I would suggest
using the <for> task, rather than the <foreach> task, because the <for>
task has a keepgiong attribute.

Here is a solution that works for me.

<target name="looptest">
  <for list="${name.list}" param="sourceappname" keepgoing="true">
    <sequential>
      <antcall target="call-second" inheritall="true">
        <param name="sourceappname.a" value="@{sourceappname}"/>
      </antcall>
    </sequential>
  </for>
</target>

<target name="call-second">
  <input message="Do you want to deploy ${sourceappname.a}?"
validargs="y,n" addproperty="user.selection"/>
  <condition property="do.abort">
    <equals arg1="n" arg2="${user.selection}"/>
  </condition>

  <fail if="do.abort"> ******* You have chosen not to deploy
${sourceappname.a}. *****</fail>
  <echo>Deploying ${sourceappname.a}</echo>
  <!-- tasks to deploy the app -->
</target>


-Rob Anderson

 

> -----Original Message-----
> From: Shailesh Sharma [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, March 29, 2007 7:54 AM
> To: Ant Users List
> Subject: RE: Problem with condition selection property; Help needed
> 
> Rob, Thanks for atleast writing something. I am still having 
> that problem.
>    
>   Actually this is the scenario:
>    
>   I am using this build to deploy my application ear files. I 
> have 3 ear files in total. But it could sometimes be less or 
> more than 3. So, this build is a generic script.
>    
>   Basically,  every time when i deploy my application ear 
> file, this build ask me for a selection "Y/N" -- when i 
> accept "Y" it deploy that particular file, then it ask me for 
> the next and so on so forth.
>    
>   But when i accept "N" as a selection for the first ear 
> file, it just comes out as "build failed". I do not want 
> that. I want to move on to the next ear file for me to get 
> selection "Y/N" again till i ran out of my number of ear 
> files IRRESPECTIVE of me selecting "N" for particular ear 
> files( that i do not want to deploy momentarily).
>    
>   Please advise and let me know how to change the logic.
>   
> 
> "Anderson, Rob (Global Trade)" <[EMAIL PROTECTED]> wrote:
>   Shailesh, When fail is executed, the build fails. What are 
> you expecting
> to happen?
> 
> -Rob Anderson
> 
> 
> 
> > -----Original Message-----
> > From: Shailesh Sharma [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, March 26, 2007 7:01 PM
> > To: Ant Users List
> > Subject: Re: Problem with condition selection property; Help needed
> > 
> > I am still scratching my head on my problem. Any help is 
> > much much appreciated.
> > 
> > Best Regards.
> > 
> > 
> > Shailesh Sharma wrote:
> > Hi,
> > I have a "for loop" in one target that iterates through few 
> > times and then call my actual deployment target".
> > 
> > The problem is that when I accept "n" (i.e NO) as the first 
> > selection, the whole build just comes out of the loop and do 
> > not allow me to choose selection for the rest of the files in 
> > the "for loop".
> > 
> > Please help.
> > 
> > Exception:
> > 
> > BUILD FAILED
> > file:/export/bea/Win-splus/SPLUS/QPS/scripts/build.xml:62: 
> > ******* You have choosen not to continue. Build aborted by 
> > user. *******
> > 
> > 
> > Following is snippet of my build.xml file ...
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > [input] message="Aceepy either y or n to continue and then 
> > press enter"
> > 
> > validargs="y,n"
> > addproperty="user.selection"
> > />
> > 
> > 
> > 
> > 
> > 
> > ******* You have choosen not to continue. Build aborted by 
> > user. *******
> > 
> > .
> > .
> > .
> > .
> > ..
> > 
> > 
> > 
> > 
> > 
> > 
> > ---------------------------------
> > Bored stiff? Loosen up...
> > Download and play hundreds of games for free on Yahoo! Games.
> > 
> > 
> > ---------------------------------
> > Expecting? Get great news right away with email Auto-Check.
> > Try the Yahoo! Mail Beta.
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
>  
> ---------------------------------
> Sucker-punch spam with award-winning protection.
>  Try the free Yahoo! Mail Beta.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to