ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ciramella, EJ" <ECirame...@emptoris.com>
Subject RE: returning build failed error code from ant.bat
Date Wed, 11 Jun 2003 13:45:17 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message