Thanks Mike,
it looks like the only way to solve this it's your way
I tried also this code:
<exec
program="${sys.env.ANT_HOME}\bin\ant.bat"
workingdir="${current.dir}"
commandline="-buildfile ${java.build.file}compile"
failonerror="false"
resultproperty="ant.exit.code"
/>
and then
<fail if="${ant.exit.code != '0'}" message="Java build failed!\r\n"/>
but ${ant.exit.code} got value of 0 even if ant fails...
btw, I'm using ant 1.7.0 (beta1), I think it's important enough to fix it
before 1.7.0 goes official, isn't it!?
any way %ERRORLEVEL% does the work just fine.
----- Original Message ----
From: Mike Roberts <[EMAIL PROTECTED]>
To: Moshe Hajaj <[EMAIL PROTECTED]>
Cc: nant-users@lists.sourceforge.net
Sent: Tuesday, November 28, 2006 2:03:35 PM
Subject: Re: [NAnt-users] running apache-ant through exec doesn't return fail
status
I call ant.bat from CruiseControl.NET but I have the same problem
The ant.bat script doesn't respect error codes properly. I edit mine
and put the following line at the end:
exit %ERRORLEVEL%
The only problem with this is that if you run it from a normal command
prompt it exits the command prompt window, so I actually copy ant.bat
to another file ('and-and-exit.bat'), edit that one and then point
CCNet (nant in your case) to that.
HTH,
Mike
On 28/11/06, Moshe Hajaj <[EMAIL PROTECTED]> wrote:
>
>
>
>
> I'm trying to combine a java build inside my existing NAnt/.NET nuild
> script.
>
> The problem is that executing Ant this way:
>
>
>
> <exec
>
> program="${sys.env.ANT_HOME}\bin\ant.bat"
>
> workingdir="${current.dir}"
>
> commandline="-buildfile ibm_java.xml compile"
>
> failonerror="true"
>
> />
>
>
>
> is not causing the build to fail.
>
>
>
>
>
> Wrapping it with:
>
>
>
> <trycatch>
>
> <try>
>
> ….
>
> </try>
>
> <catch property="failure">
>
> <echo message="Java build failed!"/>
>
> <fail message="${failure}" />
>
> </catch>
>
> </trycatch>
>
>
>
> doesn't work either.
>
>
>
> Is there's any way I can have Ant report on error? I checked my XML log file
> (through xml listener) and it captures the errors as warnings!
>
> Any idea, someone?
>
>
>
> Thanks,
>
> `M
>
>
> ________________________________
> Access over 1 million songs - Yahoo! Music Unlimited.
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> _______________________________________________
> NAnt-users mailing list
> NAnt-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nant-users
>
>
>
--
mike roberts | http://www.mikebroberts.com/
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users