Community
Participate
Working Groups
I'm running the following test build.xml to compile a single java file. Eclipse creates a class file for me even the source has syntax erros. Following are steps to reproduce: 0. Suppose current time is 9:00AM and the source file is correct. 1. Use menu Run->External Tools to run the target "fast-build" in build.xml 2. Eclipse generates a class file correctly with timestamp 9:01AM 3. Wait a minute and comment out the constant definition at line 2 in the source. The file is saved at 9:02AM. 4. Use menu Run->External Tools to run the target "fast-build" again, Eclipse creates a new class file with timestamp 9:02AM. The compiler detects the source is newer than the old class file. So it tries to recompile. It should report a syntax error. However it somehow generates a new class file and displays "build successful" in the Console window. Note it does flag the error in Problem window. But this is not enough. Console window should show the error too. 5. Now delete the new class file with timestamp 9:02AM from file system and run the "fast-build" target again. This time Eclipse shows the syntax error in Console window. Attached are source file, build.xml, .classpath and .project. ***************************************** Source file: public class TestEclipseCompiler { public static final String JNDI_NAME = "MyJNDIName"; public static void main(String args[]) { System.out.println(JNDI_NAME); } } ***************************************** Build.xml: <project name="Test Eclipse Compiler" default="fast-build" basedir="."> <property name="src" location="${basedir}"/> <property name="destclass" location="${basedir}/class"/> <property name="destjar" location="${basedir}/jar"/> <target name="init" description="Initialize the build"> <tstamp/> <mkdir dir="${destclass}"/> <mkdir dir="${destjar}"/> </target> <target name="clean" depends="init" description="Clean the build"> <delete includeemptydirs="true"> <fileset dir="${destclass}" includes="**/*"/> </delete> <delete includeemptydirs="true"> <fileset dir="${destjar}" includes="**/*"/> </delete> </target> <target name="fast-build" depends="init" description="Build the project"> <javac srcdir="${src}" destdir="${destclass}" source="1.4" /> <jar jarfile="${destjar}/TestEclipseCompiler.jar" basedir="${destclass}" > </jar> </target> <target name="build-all" depends="clean, fast-build" description="Build the project completetly"> </target> </project> ***************************************** .classpath: <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path=""/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="class"/> </classpath> ***************************************** .project: <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>TestEclipseCompiler</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription>
Created attachment 73553 [details] Test source file, build.xml, .classpath and .project
Move it back to JDT/Core for investigation.
Did you disable the java builder ?
Disabling the auto-build doesn't disable the java builder. Select the project. Open the properties Go to Builders entry and uncheck the java builder. Let me know if this fixes it.
It worked after disabling the java builder. Thanks, Olivier!
Closing as INVALID. The .class files were generated by the java builder and not by the ant adapter.
Verified by reporter