Compiling GWT 2.6.1 at Java 7 source level

Posted by Neeko on Stack Overflow See other posts from Stack Overflow or by Neeko
Published on 2014-05-30T15:22:31Z Indexed on 2014/05/30 15:24 UTC
Read the original article Hit count: 189

Filed under:
|
|

I've recently updated my GWT project to 2.6.1, and started to make use of Java 7 syntax since 2.6 now supports Java 7.

However, when I attempt to compile, I'm receiving compiler errors such as

[ERROR] Line 42: '<>' operator is not allowed for source level below 1.7

How do I specify the GWT compiler to target 1.7? I was under the impression that it would do that by default, but I guess not. I've attempted cleaning the project, including deleting the gwt-unitCache directory but to no avail.

Here is my Ant compile target.

    <target name="compile" depends="prepare">
        <javac includeantruntime="false"
               debug="on"
               debuglevel="lines,vars,source"
               srcdir="${src.dir}"
               destdir="${build.dir}">
            <classpath refid="project.classpath"/>
        </javac>
    </target>

    <target name="gwt-compile" depends="compile">
        <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
            <classpath>
                <!-- src dir is added to ensure the module.xml file(s) are on the classpath -->
                <pathelement location="${src.dir}"/>
                <pathelement location="${build.dir}"/>
                <path refid="project.classpath"/>
            </classpath>
            <jvmarg value="-Xmx256M"/>
            <arg value="${gwt.module.name}"/>
        </java>
    </target>

© Stack Overflow or respective owner

Related posts about java

Related posts about gwt