Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Databases > Re: error handl...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 3592 of 3850
Post > Topic >>

Re: error handling in ant

by "Chris ( Val )" <chrisval@[EMAIL PROTECTED] > Nov 14, 2007 at 05:50 AM

On Nov 14, 11:04 pm, "Vitvitskiy Vladimir"
<vvitvits...@[EMAIL PROTECTED]
> wrote:
> "Chris ( Val )" <chris...@[EMAIL PROTECTED]
> wrote in
messagenews:1195036361.500148.284400@[EMAIL PROTECTED]
>
>
>
>
>
> > On Nov 14, 5:47 pm, "Vitvitskiy Vladimir"
> > <vvitvits...@[EMAIL PROTECTED]
> wrote:
> >> "Owen Jacobson" <angrybald...@[EMAIL PROTECTED]
> wrote in message
>
> >>news:1194970367.222167.12600@[EMAIL PROTECTED]
>
> >> > On Nov 13, 5:28 am, Lew <l...@[EMAIL PROTECTED]
> wrote:
> >> >> Multiposted message unified.
>
> >> >> Vitvitskiy Vladimir wrote:
> >> >> > Hi all, doesanthave possibility to handle errors ?
> >> >> > To be clear, i try to use oracleantext to redeploy oc4j war/ear
> >> >> > application
> >> >> >Antwhen app is not deployed "redeploy" task throws me failure -->
i
> >> >> > want
> >> >> > then deploy ...
> >> >> > How can i make it use this workflow ? Thanks
>
> >> > It Depends.
>
> >> > My first thought would be to avoid the failure entirely.  Can you
use
> >> > conditionals to detect whether something is already deployed (based
> >> > on, for example, the existence or non-existence of a file)?  If so,
> >> > you can select 'redeploy' vs 'deploy' before trying either one, and
> >> > allow failures to act as they normally do.
>
> >> > Alternately, you might be able to write a custom task (if one
doesn't
> >> > exist already, google is your friend) to handle the failure by
setting
> >> > a property or evaluating another task.  It's possible the task
you're
> >> > using to redeploy your app has this already; check the docs for the
> >> > attributes and elements the tag sup****ts.
>
> >> that is why i am asking ! i don't have access to internet only to
> >> newsgroups. All that i found in docs - this is possibility to
> >> play with "onerrror" attribute in task, but not all task have it, no
more
> >> docs to get additional info. thanks- Hide quoted text -
>
> > If you can avoid theerrorin the first place (as suggested
> > by Owen), by setting some property and adding some conditional
> > checks thereafter, then that would be the ideal situation.
>
> > If that is not ideal or possible for your situation,Anthas
> > a <fail> tag available, allowing you to throw an exception.
>
> > If you install an externalAnttool such as: "Ant-contrib",
> > then you can use the <fail> tag in conjunction with <try>,
> > <catch> and <finally> tags, as provided by "Ant-contrib".
>
> > I have tested it, and it seems to work ok.
>
> > --
> > Chris
>
> Chris, "as suggested by Owen" - Owen - author of book ?

Um..., you did read the response you received, didn't you?

> What property and condition can help me to catch that failure or
makeantto
> ingnore it ?

You can't just "ignore" it, you need to "address" it,
if it is causing you a problem :-)

> Second method with "ant- contrib" does not suits me

Why not?

It's just a ".jar" file you download and place in your
lib directory, and that's it.

Anyway, you can use the <available> tag with the <fail>
tag and a couple of specialised targets:

  -- "TestCase.xml" --

<project basedir="." default="redeploy">

  <property name="dir" value="c:\foo" />
  <available file="${dir}" property="dir.available"/>

  <target name="dirExists" unless="dir.available">
    <fail message="Directory ${dir} does not exist!"/>
  </target>

  <target name="redeploy" depends="dirExists">
    <echo message="Directory ${dir} exists!"/>
  </target>

</project>

    C:\> ant -f TestCase.xml

--
Chris
 




 2 Posts in Topic:
Re: error handling in ant
"Chris ( Val )"  2007-11-14 05:50:23 
Re: error handling in ant
"Vitvitskiy Vladimir  2007-11-15 16:32:37 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 6:23:54 CDT 2008.