ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ciramella, EJ" <ECirame...@emptoris.com>
Subject RE: Return code from Ant
Date Tue, 28 Oct 2003 19:56:06 GMT
Depending on how badly you want to capture the error code, you can change
the ant.bat file:

:runAnt
"%_JAVACMD%" %ANT_OPTS% -classpath "%LOCALCLASSPATH%"
"-Dant.home=%ANT_HOME%" org.apache.tools.ant.Main %ANT_ARGS%
%ANT_CMD_LINE_ARGS%
if "%errorlevel%"=="0" goto end

:auto-mail
if /I not "%AUTOBUILD%"=="true" goto end
echo FAILURE!!!!
d:
cd \auto-home-mail
call auto-notify.bat
goto end

This is the code I have added to send notification to my cell phone if a
build fails...

-----Original Message-----
From: Weiqi Gao [mailto:weiqigao@networkusa.net]
Sent: Tuesday, October 28, 2003 1:50 PM
To: Ant Users List
Subject: Re: Return code from Ant


Jing Xue wrote:

> Quoting Stefan Bodewig <bodewig@apache.org>:
> 
> > On 27 Oct 2003, Weiqi Gao <weiqigao@networkusa.net> wrote:
> > 
> > 
> > > However in my testing I discovered that Ant's return code is always
> > > 0
> > 
> > Not in my case:
> 
> [snipped]
> 
> > This is Linux, /bin/sh is bash.
> > 
> 
> Not that it'd be directly helpful to the OP, just wanted to confirm that
it 
> returns error codes on Windows as well:
> 
> c:\work\build>%ant_home%\bin\ant clean
> Buildfile: build.xml
> 
> clean:
>    [delete] Deleting directory c:\work\build\classes
> 
> BUILD SUCCESSFUL
> Total time: 1 second
> c:\work\build>echo %ERRORLEVEL%
> 0
> 
> c:\work\build>%ant_home%\bin\ant invalid-target
> Buildfile: build.xml
> 
> BUILD FAILED
> Target `invalid-target' does not exist in this project.
> 
> Total time: 0 seconds
> c:\work\build>echo %ERRORLEVEL%

Upon close inspection, the error comes out of the stcheckout (StarTeam 
Checkout) task, not from the delete task.  Sorry for the confusion.

--
Weiqi Gao
weiqigao@networkusa.net
http://www.weiqigao.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