Community
Participate
Working Groups
From EC: Hi, I use the JDTCompilerAdapter in ant scripts. The script always completes with "BUILD SUCCESSFUL" even there are compiler errors. failonerror is set to true. Any idea how to comunicate the compile error to ant ? See ant log snippet below: [javac] Using JDT compiler [javac] Compilation arguments: [javac] '-noExit' [javac] '-classpath' [javac] 'D:\sbi\audi\build\integration\zzLibs\Gwp\1.5\classes.zip;D:\sbi\aud i\build\integration\zzLibs\Gwp\1.5\collx.zip;D:\sbi\audi\build\integration\zzLib s\Gwp\1.5\timer.zip;D:\sbi\audi\build\integration\zzLibs\OSGi\2.0\osgi.jar;D:\sb i\audi\build\integration\zzLibs\javax.servlet\2.1\servlet.jar;D:\sbi\audi\build\ integration\zzLibs\JUnit\3.7\junit.jar;D:\sbi\audi\build\integration\zzLibs\Mock Objects\02.05.2002\mockobjects-core.jar;D:\sbi\audi\build\integration\zzLibs\MQe \1.2.7\MQeGateway.jar;C:\Programme\j2sdk1.4.0\jre\lib\ext\Coroutine4Java.jar;C:\ Programme\j2sdk1.4.0\jre\lib\ext\dnsns.jar;C:\Programme\j2sdk1.4.0\jre\lib\ext\l dapsec.jar;C:\Programme\j2sdk1.4.0\jre\lib\ext\localedata.jar;C:\Programme\j2sdk 1.4.0\jre\lib\ext\sunjce_provider.jar;D:\sbi\audi\build\integration\BackendProto typing\bin;D:\sbi\audi\build\integration\Utilities\bin;D:\sbi\audi\build\integra tion\zzLibs\JavaRuntime\1.4.0\rt.jar' [javac] '-warn:constructorName,packageDefaultMethod,maskedCatchBlocks,deprec ation' [javac] '-d' [javac] 'D:\sbi\audi\build\integration\BackendPrototyping\bin' [javac] '-g' [javac] '-time' [javac] '-noImportError' [javac] [javac] The ' characters around the executable and arguments are [javac] not part of the command. [javac] Files to be compiled: [javac] D:\sbi\audi\build\integration\BackendPrototyping\src\de\dreisoft \audi\telematics\backend\prototype\BackendBean.java [javac] D:\sbi\audi\build\integration\BackendPrototyping\src\de\dreisoft \audi\telematics\backend\prototype\BackendContext.java [javac] D:\sbi\audi\build\integration\BackendPrototyping\src\de\dreisoft \audi\telematics\backend\prototype\BackendControlServlet.java [javac] D:\sbi\audi\build\integration\BackendPrototyping\src\de\dreisoft \audi\telematics\backend\prototype\BHBackendBean.java [javac] D:\sbi\audi\build\integration\BackendPrototyping\src\de\dreisoft \audi\telematics\backend\prototype\Constants.java [javac] D:\sbi\audi\build\integration\BackendPrototyping\src\de\dreisoft \audi\telematics\backend\prototype\DLUBackendBean.java [javac] D:\sbi\audi\build\integration\BackendPrototyping\src\de\dreisoft \audi\telematics\backend\prototype\HBackendBean.java [javac] D:\sbi\audi\build\integration\BackendPrototyping\src\de\dreisoft \audi\telematics\backend\prototype\TTBackendBean.java [javac] ---------- [javac] 1. ERROR in D:\sbi\audi\build\integration\BackendPrototyping\src\de\ dreisoft\audi\telematics\backend\prototype\TTBackendBean.java (at line 22) [javac] } [javac] ^ [javac] Syntax error on token "}", ";" expected [javac] ---------- [javac] Compiled 1704 lines in 3359 ms (507.2 lines/s) [javac] 1 problem (1 error) [javac] 9 .class files generated BUILD SUCCESSFUL Total time: 6 seconds Best Regards, Stefan
We always return true from the execute method of the JDTCompilerAdapter. We should not call directly the main method of the batch compiler, but rather create a new instance and call compile(String[]) which returns a boolean. It should be fairly simple to fix this issue. If the compilation fails, return false, otherwise return true.
Using the compile method of the batch compiler fixed the problem. Wait for approval to release.
Does running the default javac task (using JDK javac) provide such a behavior ? If so, then the proposal sounds good to me, please go ahead and release the fix.
Yes, javac uses a method that returns a boolean according to the result of the compilation. Then ANT is using this value to report whether or not the build was successful. Should I release in 2.0.2 stream as well?
Fixed and released in 2.1 stream.
Verified.