Google Web Toolkit编译错误,找不到GTW编译器



当我想编译我的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:UsersDonatasDesktopb2blibgwt-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:UsersDonatasDesktopb2bservletnbprojectbuild-gwt.xml:326: The following error occurred while executing this line:
C:UsersDonatasDesktopb2bservletnbprojectbuild-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是不推荐使用的,但如果我在Compiler中进行更改,如何更改它?我遇到了一个错误,即我的控制台参数(如[-out])无法识别。那么如何编译呢?我使用的是GTW2.7版本。

它看起来像GWT4NB中的一个bug。它应该为GWT2.7调用do-gwt-compile-25,而不是do-gwt-compile-15

尝试手动更新build-gwt.xml以向gwt.version.25添加2.7个案例:https://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插件覆盖)

从GWT1.7左右开始,编译器就没有被调用过GWTCompiler。请使用com.google.gwt.dev.Compiler作为类名。

<!-- 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

打开build-gwt.xml

然后,

尝试删除:

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

运行,这应该工作

最新更新