Google Web Toolkit 编译错误,找不到 GTWCompiler

Google Web Toolkit compiling error, could not find GTWCompiler

当我想编译我的 GTW 项目时,我在我的控制台中得到了这个输出:

ant -f "C:\Users\Donatas\Desktop\b2b\servlet" "-Dbrowser.context=C:\Users\Donatas\Desktop\b2b\servlet" -DforceRedeploy=false -Ddirectory.deployment.supported=true -Dnb.internal.action.name=run run
init:
deps-module-jar:
deps-ear-jar:
deps-jar:
wsimport-init:
wsimport-client-ic:
files are up to date
wsimport-client-generate:
library-inclusion-in-archive:
library-inclusion-in-manifest:
compile:
compile-jsps:
GWT4NB https://github.com/gwt4nb/gwt4nb
GWT installation directory: C:\Users\Donatas\Desktop\b2b\lib\gwt-2.7.0
init:
do-gwt-compile-15:
GWT Compiling client-side code.
Error: Could not find or load main class com.google.gwt.dev.GWTCompiler
C:\Users\Donatas\Desktop\b2b\servlet\nbproject\build-gwt.xml:326: The following error occurred while executing this line:
C:\Users\Donatas\Desktop\b2b\servlet\nbproject\build-gwt.xml:356: Java returned: 1

我的build-gtw.xml 326行是:

    <target name="-pre-dist" depends="-gwt-define-compile-unneeded">
        <antcall target="-gwt-print-dir"/>
326:    <antcall target="do-gwt-compile-15" />
        <antcall target="do-gwt-compile-16" />
        <antcall target="do-gwt-compile-17" />
        <antcall target="do-gwt-compile-20" />
        <antcall target="do-gwt-compile-23" />
        <antcall target="do-gwt-compile-25" />
    </target>

我的build-gtw.xml 356行是:

       <target name="do-gwt-compile-15" if="gwt.version.15" 
                unless="gwt.compile.unneeded" depends="-init-gwt-dir">
            <!-- You can override this property in the 'gwt.properties' file -->
            <property name="gwt.compiler.output.style" value="OBFUSCATED"/>
            <property name="gwt.compiler.logLevel" value="WARN"/>
            <echo>GWT Compiling client-side code.</echo>
            <java failonerror="true"
                  classname="com.google.gwt.dev.GWTCompiler" fork="true"
line 356:         jvmargs="${gwt.compiler.jvmargs}">
                <classpath>
                    <!--
                    GWT libraries are mentioned here explicitly so they are always
                    at the front of the class path.
                    -->
                    <pathelement path="${gwt.dir}/gwt-user.jar"/>
                    <fileset dir="${gwt.dir}">
                        <include name="gwt-dev-*.jar"/>
                    </fileset>
                    <pathelement path="${gwt.dir}/gwt-servlet.jar"/>
                    <pathelement path="${javac.classpath}"/>
                    <pathelement path="${src.dir}"/>
                    <pathelement path="${build.classes.dir}"/>
                </classpath>
                <arg value="-out"/>
                <arg path="${build.web.dir}/"/>
                <arg value="-style"/>
                <arg value="${gwt.compiler.output.style}"/>
                <arg value="-logLevel"/>
                <arg value="${gwt.compiler.logLevel}"/>
                <arg line="${gwt.compiler.args}"/>
                <arg line="${gwt.module}"/>
            </java>

            <property name="gwt.output.dir" value="${gwt.module}"/>

            <move todir="${build.web.dir}/${gwt.output.dir}">
                <fileset dir="${build.web.dir}/${gwt.module}"/>
            </move>
            <touch file="${build.dir}/gwtc.run"/>
        </target>

我知道 GWTCompiler 已被弃用,但是如果我在编译器中更改如何更改它我收到错误消息,无法识别我的控制台参数,如 [-out]。那么如何编译呢。我使用的是 GTW 2.7 版本。

编译器 GWTCompiler 自 GWT 1.7 左右以来未被调用。使用 com.google.gwt.dev.Compiler 作为类名。

这看起来像是 GWT4NB 中的错误。它应该为 GWT 2.7 调用 do-gwt-compile-25,而不是 do-gwt-compile-15

尝试手动更新 build-gwt.xml 以将 2.7 案例添加到 gwt.version.25https://github.com/ksfreitas/gwt4nb/blob/1001c4fa8e9f6c0fed3c79ba19320b315737357f/trunk/src/org/netbeans/modules/gwt4nb/resources/build-gwt.xml#L139-L147

但由于另一个错误(问题仍然存在,不知道是否已修复,我不使用 Netbeans),它可能无法工作:https://github.com/ksfreitas/gwt4nb/issues/32(快速 grep代码似乎表明您可以在项目的 nbproject/gwt.properties 中定义 gwt.version=2.6 或 gwt.version=2.7,不确定它是否会工作或被 Netbeans 插件覆盖)

<!-- Check for GWT 2.5 --> <condition property="gwt.version.25" value="true"> <or> <equals arg1="${gwt.version}" arg2="2.5"/> <equals arg1="${gwt.version}" arg2="2.6"/> <equals arg1="${gwt.version}" arg2="2.7"/> --> add this line </or> </condition>

我在 build-gwt.xml 上添加了版本 2.7,它对我有用 :D

打开构建-gwt.xml

然后,

尝试删除:

  <antcall target="do-gwt-compile-15" />

运行,这应该有效