Return-Path: Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 34861 invoked by uid 500); 11 Jun 2003 13:46:46 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 34818 invoked from network); 11 Jun 2003 13:46:44 -0000 Received: from unknown (HELO empburexch.burlington.emptoris.com) (63.111.224.162) by daedalus.apache.org with SMTP; 11 Jun 2003 13:46:44 -0000 Received: by empburexch.burlington.emptoris.com with Internet Mail Service (5.5.2653.19) id ; Wed, 11 Jun 2003 09:45:18 -0400 Message-ID: <15717BB71A5CD411A01600508BDCC2E201AFE6A8@empburexch.burlington.emptoris.com> From: "Ciramella, EJ" To: 'Ant Users List' Subject: RE: returning build failed error code from ant.bat Date: Wed, 11 Jun 2003 09:45:17 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C3301F.B17155A0" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C3301F.B17155A0 Content-Type: text/plain; charset="iso-8859-1" Funny, I just did something like this to call another build.xml file, maybe there's group support for this... -----Original Message----- From: Dennis Wheeler [mailto:denniswheeler@yahoo.com] Sent: Tuesday, June 10, 2003 6:49 PM To: user@ant.apache.org Subject: returning build failed error code from ant.bat Searching through the archives, I found this question asked many times, however I found no satisfying answers -- including one response claiming that a bug was written and closed as "don't know how to fix" The problem: running ant.bat from another script, such as make. If ant fails, the build script still continues. How do I detect these build failures when ant.bat always returns true? The solution: in effect, I've already answered my own question -- it's the javacmd (or any other command) that is in fact returning a proper error code, but the batch file is not trapping nor responding to it, so ant.bat just happily continues and always returns true. modify ant.bat to trap for and respond to errors, for example :runAnt "%_JAVACMD%" blah blah blah || if errorlevel 1 exit 1 goto end Now if the javacmd fails, if errorlevel will detect the error and we'll return a non-true exit code from the batch file so the the makefile or other wrapper script can detect the error. Of course, a more elegant fix would be to have a proper errorhandling subroutine to clean up various environment variables and such, but I'll leave that as an exercise to the reader. __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org ------_=_NextPart_001_01C3301F.B17155A0--