ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Gies <olivier.g...@bull.net>
Subject Re: How to run an ant target on success/failed build
Date Wed, 23 Jul 2008 01:48:12 GMT
One solution is to use ant-contrib's <trycatch> task:

1) Direct usage:
<trycatch>
	<try>
		<!-- Your code here -->

		<mail message="Success" ... >
	</try>
	<catch>
		<mail message="Failure" ... >
	</catch>
</trycatch>

2) If you need the failure message in the mail (in combination with 
ant-contrib's <if>):

<trycatch property="errormessage">
	<try>
		<!-- Your code here -->
	</try>
	<catch>
	</catch>
</trycatch>

<if>
	<not><isset property="errormessage"/></not>
	<then>
		<mail message="Success" ... >
	</then>
	<else>
		<mail message="Failure: ${errormessage}" ... >
	</else>
</if>


See http://ant-contrib.sourceforge.net/tasks/tasks/index.html for more 
details.

Regrads,


*Olivier Gies*

*Delivery Manager
Customs & Tax Software Engineering Center
Bull, Architect of an Open World ^TM
Phone: +86 (10) 65978001 - Ext 555 *

*www.bull.com <http://www.bull.com/>*

*This e-mail contains material that is confidential for the sole use of
the intended recipient. Any review, reliance or distribution by others
or forwarding without express permission is strictly prohibited. If you
are not the intended recipient, please contact the sender and delete all
copies.*



-------- Original Message  --------
Subject: How to run an ant target on success/failed build
From: p2008 <prempel@gmail.com>
To: user@ant.apache.org
Date: 23/07/2008 06:36

> I need to be able to trigger running a specific ant target when the build
> succeeds, and another one when it fails.  This will be used to send out an
> email indicating the status of the build.
> 
> I have done this in the past in nant (.NET) which has a built in property
> called nant.onsuccess and one called nant.onfailure.  
> 
> Is there something similar in ant, or any does anybody know how to do this?
> 
> Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message