ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Echlin, Robert" <Robert.Ech...@windriver.com>
Subject RE: Do things based on project success or failure
Date Thu, 02 Jun 2011 16:02:02 GMT
Hi Eric,
Look up "subant" and "antcall" for a start. They are in "core tasks".
If you put both tasks in the same xml file, you will use "antcall".

Also, for your DB operation, look up "sql" task, which uses JDBC.

Rob

--
Rob Echlin, Documentation Systems Architect, Wind River
direct: +1.613.270.5796  |  robert.echlin@windriver.com
 

> -----Original Message-----
> From: Eric Fetzer [mailto:elstonkers@yahoo.com] 
> Sent: Thursday, June 02, 2011 11:20 AM
> To: Ant Users List
> Subject: Re: Do things based on project success or failure
> 
> Of course this presents me another issue.  How do I gather up 
> all of the command line arguments that were passed to me so 
> that I can re-pass them to the next ant script.  Is there a 
> way to say:  <property name="allArgs" 
> value="allOfMyArgsThatWerePassedToMe"/>?
> 
> Thanks,
> Eric
> 
> 
> 
> 
> ________________________________
> From: Eric Fetzer <elstonkers@yahoo.com>
> To: Ant Users <user@ant.apache.org>
> Sent: Thu, June 2, 2011 9:02:14 AM
> Subject: Do things based on project success or failure
> 
> I have to update a database one way or another based on 
> project success or failure.  So I'm messing around with the 
> <exec> task with errorproperty attribute.  I'm trying to make 
> it so that failure will test one way vs. success testing 
> another.  The best thing I can come up with is the following:
> 
> <----------------------------------------------------------------->
> Build File 1:
> 
> <project name="test" default="test">
>  <taskdef resource="net/sf/antcontrib/antlib.xml"/>
>  <target name="test">
>     <exec dir="." executable="cmd.exe" errorproperty="returncode">
>       <arg line="/c ant -f test2.xml -Dgood=${good}"/>
>     </exec>
>     <echo message="returncode is: ${returncode}"/>
>    
>     <if>
>       <equals arg1="${returncode}" arg2="" />
>       <then>
>         <echo message="It succeeded"/>
>       </then>
>       <else>
>         <echo message="It failed"/>
>       </else>
>     </if>
>  </target>
> </project>
> 
> Build File 2:
> 
> <project name="test2" default="test">
>  <taskdef resource="net/sf/antcontrib/antlib.xml"/>
>  <target name="test">
>    <if>
>    <equals arg1="${good}" arg2="true" />
>      <then>
>        <echo message="Good!"/>
>      </then>
>      <else>
>        <echo message="Bad"/>
>        <fail/>
>      </else>
>    </if>
>  </target>
> </project>
> 
> </----------------------------------------------------------------->
> 
> So if I pass >ant -f test.xml -Dgood="true"
> I end up in the success code.  Or if I pass >ant -f test.xml 
> -Dgood="anythingElse"
> I end up in the failure code.
> 
> Does anyone have a more graceful way to do this?
> 
> Thanks,
> Eric
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message