Community
Participate
Working Groups
Hi, if the JDT compiler encounters compile errors, the produced XML log file is not valid (it doesn't has a </sources> element). I'm calling this compiler from Ant like this: <java fork="true" jar="C:/java/tools/org.eclipse.jdt.core_3.1.0.jar"> <arg line="-cp ${jdt-compile.classpath}" /> <arg line="-d none" /> <arg line="-warn:deprecation" /> <arg line="-source 1.4"/> <arg line="-log ${build.reports.deprecated}/compile-warnings.xml" /> <arg line="${src.dir} ${src.test.dir}" /> </java> regards, Maarten
Do you mean syntax errors?
This is an example of the generated XML file when compilation fails. Remark that there is no closing "</sources>" tag before the <stats> element! This makes the file unusable since no XML parser will be able to parse it! <?xml version="1.0" encoding="UTF-8"?> <!-- 13 jul 2005 16:01:04 --> <!DOCTYPE compiler SYSTEM "compiler.dtd"> <compiler name="Eclipse Java Compiler" copyright="Copyright IBM Corp 2000, 2005. All rights reserved." version="0.570, 3.1.0 release"> <command_line> ... </command_line> <options> ... </options> <classpaths> </classpaths> <sources> <source path="c:\temp\FaultTest.java"> <problems problems="1" errors="1" warnings="0"> <problem charEnd="959" charStart="952" severity="ERROR" line="36" id="UndefinedName"> <message value="message2 cannot be resolved"/> <source_context value="super (message2);" sourceStart="6" sourceEnd="13"/> <arguments> <argument value="message2"/> </arguments> </problem> </problems> </source> <stats> <problem_summary problems="1" errors="1" warnings="0" tasks="0"/> </stats> </compiler>
Could you please provide your test case? I tried and it works fine for me. Could you also specify the build id?
How do I know the build id? I've used the jar that came with the eclipse 3.1 release.... I'll provide a test case tomorrow. Some extra information: I've used: - ant 1.6.1 - jdk 1.4.2_06 - windows 2000 I've ran the ant build script outside Eclipse. regards Maarten
Created attachment 24733 [details] The Ant build file This is the Ant build file that calls the JDT compiler
Created attachment 24734 [details] A test class This is a java file that doesn't compile
Created attachment 24736 [details] The compiler output This is the output produced by the JDT compiler. As you can see, the produced XML is not well-formed since there is no closing </sources> tag.
I've added a test case. 1. Place the build.xml and the java file in a directory. 2. Modify the path to org.eclipse.jdt.core_3.1.0.jar in the build.xml file 2. Run "ant compile" from the command prompt. This produces a file 'compiler.xml'. I've uploaded this compiler.xml file as well I'm using: - Ant 1.6.1 - Java 1.4.2_06 (build 1.4.2_06-b03) - Windows 2000 - Eclipse 3.1 regards, Maarten
Reproduced. I am working on it.
I can reproduce using the ant adapter, but I cannot reproduce using the batch compiler. I am investigating what could be wrong.
Fixed and released in HEAD and 3.1 maintenance streams.
As a workaround for now, you can add the following argument: <arg line="-noExit" /> In your java task or you use a javac task with the Eclipse ant adapter. See the Eclipse doc to do so.
Verified for 3.2 M1 with I20050811-0010
Verified for 3.2 M2 with build I20050920-0010.
Verified using M20050923-1430 for 3.1.1