<target name="foo" depends="-foo.internal1,-foo.internal2,-foo.internal3"/> <target name="-foo.internal1"> <some-tasks/> ... <condition/> </target> <target name="-foo.internal2" if="should.exit"> ... </target> <target name="-foo.internal3" unless="should.exit"> <echo>error message</echo> </target>
Jan > -----Ursprüngliche Nachricht----- > Von: Michael Pelz Sherman [mailto:[EMAIL PROTECTED] > Gesendet am: Donnerstag, 17. März 2005 20:56 > An: Ant Users List > Betreff: Re: Exiting ant TARGET without aborting build > > Yeah, yeah, I know. :-) > > Mostly, I was just curious if such a thing were possible. But > I think there is > a good argument to be made for this kind of task. After all, > if one has to > break up a functionally "atomic" target into a whole bunch of > sub-targets which > will never be re-used, that's a lot more work and > organizational overhead. If I > truly need this capability (and I suspect I will), I'll > definitely take a look > at the <trycatch> task in ant-contrib. > > - mps > > --- Mark Lundquist <[EMAIL PROTECTED]> wrote: > > > > On Mar 17, 2005, at 10:04 AM, Michael Pelz Sherman wrote: > > > > > I'd like to be able to do something like this: > > > > > > <target name="foo"> > > > <some-task/> > > > <another-task/> > > > > > > <condition property="should.exit"> > > > (condition check here....) > > > </condition> > > > > > > <exit if="should.exit" message="some message"/> > > > > > > (do more-tasks...) > > > > > > </target> > > > > > > There's a general pattern that may be in play here... > whenever you have > > a target that's starting to look like a program (or a > script, if you > > prefer), it may be a sign that you aren't fully grokking > the "Ant Way". > > Try to break it down into sub-targets with the right dependencies > > expressed between them and use the 'if' or 'unless' > attribute when you > > need to control whether a target actually executes. > > > > -ml- > > > > > > > --------------------------------------------------------------------- > > 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] >