You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Krishanu Lahiri <kl...@bizagile.com> on 2001/03/08 06:01:28 UTC

Conditional target execution

How does one allow a target to be executed only if a previous target has
completed ?

Specifically, I have

<target  name="compile"  >

<target  name="unittest" depends="compile" >

<target  name="deploy" depends="unittest" >

How do I allow target "deploy" to be executed ONLY if target "unittest"
completed successfully.

I am running the <junit> task in the "unittest" target. This target
always seems to complete even if the actual test failed.

Any help will be highly appreciated.

Thanks

-Kris


regarding java.library.path

Posted by Bala Subramanian <ba...@lucid.co.in>.
Hi 
  I need urgent help from u .Iam having "SO" file .
  I want some info regarding java.library.path 
  I have to include my shared Object in java.library.path
  Please help me how to set the shared object in my java.library.path

  Excepting reply asap

 Regards 
 Bala

Re: Conditional target execution

Posted by Stefan Bodewig <bo...@apache.org>.
Krishanu Lahiri <kl...@bizagile.com> wrote:

> How does one allow a target to be executed only if a previous target
> has completed ?

Using depend, just like you did.

> How do I allow target "deploy" to be executed ONLY if target
> "unittest" completed successfully.

You need to make your unittest target stop the build process. The only
way Ant knows that a task fails is if the task tells it - by throwing
an Exception.

> I am running the <junit> task in the "unittest" target. This target
> always seems to complete even if the actual test failed.

Take a look at the haltonerror and haltonfailure attributes of
<junit>.

Stefan