Search code examples
javaeclipsejavaceclipse-jdt

Eclipse JDT Batch Compiler Compliance 1.6


I'm trying to use a multi-threaded compiler to decrease the duration of our build and I found that the eclipse JDT Batch Compiler does just that.

Our target is 1.6 and when I switch to the JDT compiler I get this error:

Compliance level '1.4' is incompatible with target level '1.6'. A compliance level '1.6' or better is required

I am using ecj-4.3.2.jar acquired from http://download.eclipse.org/eclipse/downloads/drops4/R-4.3.2-201402211700.

Here is the relevant part of our build.xml

<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<javac srcdir="${env.BUILDSRC}" 
       destdir="${env.BUILDBIN}" 
       includeantruntime="false"
       debug="on" 
       deprecation="no" 
       target="1.6" 
       source="1.6"
       fork="true" 
       executable="/opt/java/jdk1.6.0_65_64bit/bin/javac"
       memoryInitialSize="1024M"
       memoryMaximumSize="2560M"
>

Solution

  • Looks like you need to add a 'compilerarg' element to specify the compatibility level:

    <javac ....>
    
      <compilerarg compiler="org.eclipse.jdt.core.JDTCompilerAdapter" line="-1.6"/>
    
    </javac>