Community
Participate
Working Groups
Build Identifier: M20060921-0945 I am using ANT (version 1.6.2) and eclipse java compiler (version 3.2.2.r322) to compile my java project. In javac task, I specified target="1.5" and source="1.4" to compile my sources. I am getting an error saying that "[javac] Compliance level '1.4' is incompatible with target level '1.5'. A compliance level '1.5' or better is required" <javac compiler="org.eclipse.jdt.core.JDTCompilerAdapter" destdir="c:/tmp/bin" target="1.5" source="1.4"> I saw the comptability table in the site http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm and there it is mentioned that a compliance level of 1.5 can have the source=1.4 and target=1.5 But in my case, compliance level is chosen as 1.4 by default. I have attached build.xml with this entry and I used the following command to execute this build file in the command prompt. ant -lib c:/tmp/lib I copied the ecj compiler in c:/tmp/lib directory. Reproducible: Always Steps to Reproduce: 1. Get the build.xml file attached with this entry and paste it in C:/test 2. Copy the ecj.jar into C:/tmp/lib directory 3. In the command prompt (goto C:/test directory), execute the following command "ant -lib c:/tmp/lib"
Created attachment 156759 [details] Testcase - Build xml file
If you want to do this, you should add a nested compilearg element inside the javac task. <project name="buildfile " default="build"> <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" /> <target name="build"> <mkdir dir="c:/tmp/bin"/> <javac destdir="c:/tmp/bin" target="1.5" source="1.4"> <compilerarg compiler="org.eclipse.jdt.core.JDTCompilerAdapter" line="-1.5" /> <src path="C:/tmp/testlib"/> </javac> </target> </project> You should always set the build.compiler property. Closing as INVALID as the problem comes from a wrong way to invoke the batch compiler. Reopen if the code above doesn't fix your issue.
Verified for 3.6M5