So, this is my task definition <javac id="warbuild.javac" srcdir="${src.paths}" failonerror="true" errorproperty="javac.failed" includeantruntime="false" destdir="${war.build.classes.dir}" includes="${src.includes}" excludes="${src.excludes}" debug="${debug}" debuglevel="${debugevel}" memoryMaximumSize="${javac.memoryMaximumSize}" encoding="ISO-8859-1" > <!-- compiler="javac1.6" --> <classpath refid="compile.classpath" /> </javac> <fail if="javac.failed" message="javac failed" /> <echo message="javac error : ${javac.failed}" />
And this is what I get in the output [javac] Compiling 255 source files to C:\temp\build\XYZ\classes [javac] Since fork is false, ignoring memoryMaximumSize setting. [javac] error: error reading M:\clearcae_viewdir\xyz2\XYZ\WebContent\WEB-INF\lib\somejar.jar; zip file is empty [javac] warning: Supported source version 'RELEASE_6' from annotation processor 'org.apache.openjpa.persistence.meta.AnnotationProcessor6' less than -source '1.7' [javac] 1 warning [echo] javac error : ${javac.failed} And no java classes are actually compiled I would like to capture the error statement generated by javac and fail the build. Is that possible? -----Original Message----- From: WebServices Development [mailto:webservices_developm...@csx.com] Sent: Saturday, May 03, 2014 07:56 To: Ant Users List Subject: RE: Ant javac task - error doesn't fail the build The line that I had included in my initial question ( copied below again for reference ) - the error is generated by javac task - it is not just me saying "it is an error because the file size is zero". So, shouldn't the failonerror be triggered in that situation, by ant? 558 4/28/14 1:09 PM EXEC [javac] error: error reading /view/dev_view/vob/comp/project/WebContent/WEB-INF/lib/somejar.jar; zip file is empty Thanks, -----Original Message----- From: Andreas Krey [mailto:a.k...@gmx.de] Sent: Saturday, May 03, 2014 1:46 AM To: Ant Users List Subject: Re: UNS: RE: Ant javac task - error doesn't fail the build On Fri, 02 May 2014 11:05:51 +0000, WebServices Development wrote: > But with this one, I don't get the build failure, Possiby because this is not really an error. If a zip file you specified is empty, then it is empty. If that does not cause any required classes to be missed, that is not a compilation error. > but it doesn't compile any java files either. With this it might be a bug in the actual compiler you are using. ant can only fail if the compiler returns failure. Andreas -- "Totally trivial. Famous last words." From: Linus Torvalds <torvalds@*.org> Date: Fri, 22 Jan 2010 07:29:21 -0800 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org This email transmission and any accompanying attachments may contain CSX privileged and confidential information intended only for the use of the intended addressee. Any dissemination, distribution, copying or action taken in reliance on the contents of this email by anyone other than the intended recipient is strictly prohibited. If you have received this email in error please immediately delete it and notify sender at the above CSX email address. Sender and CSX accept no liability for any damage caused directly or indirectly by receipt of this email. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org This email transmission and any accompanying attachments may contain CSX privileged and confidential information intended only for the use of the intended addressee. Any dissemination, distribution, copying or action taken in reliance on the contents of this email by anyone other than the intended recipient is strictly prohibited. If you have received this email in error please immediately delete it and notify sender at the above CSX email address. Sender and CSX accept no liability for any damage caused directly or indirectly by receipt of this email. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org