ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karsten Wutzke" <kwut...@web.de>
Subject Re: Return from task with BUILD SUCCESSFUL?
Date Fri, 11 Apr 2003 01:30:52 GMT
Of course, my problem could be restated even simpler. I used the <trycatch> in hope of
successfully returning...

It's basically a simple if-then construct with successful return from the target.

    <!-- Start local Tomcat -->
    <target name="start-local" depends="check-reach-local" description="Starts local Tomcat.">
      <if>
        <not>
          <isset property="local.unreachable"/>
        </not>
        <then>
           <echo message="Local Tomcat already running! Won't restart."/>
           <!--return --> <!-- with BUILD SUCCESSFUL please -->
        </then>
      </if>
 
    <echo message="Local Tomcat not running! Starting up..."/>
 
    <!-- START UP TOMCAT -->
 
    <echo message="Local Tomcat started up."/>
 
 </target>

Any ideas?

Karsten

"Ant Users List" <user@ant.apache.org> schrieb am 11.04.03 03:17:41:
> 
> Hi all!
> 
> Is there any way in Ant to return from a target *successfully*, that is without printing
"BUILD FAILED"??? I would like a "BUILD SUCCESSFUL" message instead, so <fail> is no
go.
> 
> I'm using an ant-contrib <trycatch> construct from inside an <if>, that simply
does some checking, and when an exception is caught, I want to print some information and
return from the task from inside the <catch>. Using <throw> from inside the <catch>
raises an exception in the IfTask class...
> 
>   <!-- Start local Tomcat -->
>   <target name="start-local" depends="check-reach-local" description="Starts local
Tomcat.">
>     <if>
>       <not>
>         <isset property="local.unreachable"/>
>       </not>
>       <then>
>         <trycatch>
>           <try>
>             <fail message="Intentional fail forced! See message below."/>
>           </try>
>           <catch>
>             <echo message="Local Tomcat already running! Won't restart."/>
>             <!--return/--> <!-- HOW? -->
>           </catch>
>         </trycatch>
>       </then>
>     </if>
> 
>   <echo message="Local Tomcat not running! Starting up..."/>
> 
>   <!-- START UP TOMCAT -->
> 
>   <echo message="Local Tomcat started up."/>
> 
> </target>
> 
> Any ideas? Stefan?
> 
> Karsten
> 
> PS: Maybe an ant-contrib <return> task would help?
> PPS: Sorry for the <no subject> mail before, please ignore it
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 


______________________________________________________________________________
UNICEF bittet um Spenden fur die Kinder im Irak! Hier online an
UNICEF spenden: https://spenden.web.de/unicef/special/?mc=021101


Mime
View raw message