libGDX html构建始终失败:compileGwtException

时间:2019-07-01 12:20:07

标签: java gradle gwt libgdx

我正在尝试构建一个libGDX应用程序,并以HTML作为分发目标。

使用JAR设置应用程序进行的设置已成功运行。我仅勾选了HTML作为输出(出于这个问题),并且未添加任何扩展名。文件全部保留为已生成。

但是每当我尝试构建它时,它都会失败:

[tobias@LapTobTob test]$ ./gradlew html:dist
:html:clean
:html:addSource
:core:compileJava UP-TO-DATE
:core:processResources NO-SOURCE
:core:classes UP-TO-DATE
:core:jar UP-TO-DATE
:html:compileJavawarning: [options] bootstrap class path not set in conjunction with -source 1.6
1 warning

:html:processResources NO-SOURCE
:html:compileGwtException in thread "main" java.lang.NoSuchMethodError: com.google.gwt.util.regexfilter.RegexFilter: method <init>()V not found
        at com.google.gwt.util.regexfilter.WhitelistRegexFilter.<init>(WhitelistRegexFilter.java:21)
        at com.google.gwt.dev.jjs.JJSOptionsImpl.<init>(JJSOptionsImpl.java:54)
        at com.google.gwt.dev.PrecompileTaskOptionsImpl.<init>(PrecompileTaskOptionsImpl.java:39)
        at com.google.gwt.dev.CompilerOptionsImpl.<init>(CompilerOptionsImpl.java:30)
        at com.google.gwt.dev.Compiler.main(Compiler.java:108)
 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':html:compileGwt'.
> Process 'command '/usr/lib/jvm/java-8-openjdk/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
6 actionable tasks: 4 executed, 2 up-to-date

系统:

  • 操作系统:Archlinux \ w内核5.1.15
  • JAVA:java-8-openjdk
  • libGDX:1.9.9

2 个答案:

答案 0 :(得分:1)

检查html项目的build.gradle文件中的GWT版本是否设置为2.8.0。 1.9.9依赖于2.8.0,而设置工具可能是通过2.8.2创建的,因为这是1.9.10-SNAPSHOT所使用的。

答案 1 :(得分:1)

您有一些混合版本的GWT jar-the RegexFilter class was added in GWT 2.8.1,因此您的构建的某些部分依赖于2.8.1+,但是显然您仍然有一些将2.8.1之前的jar引入到您的构建中

此外,当您在Java 9上运行时,必须将GWT 2.8.2用作support to run on Java 9 was only added in 2.8.2

确保在运行GWT构建时仅存在GWT 2.8.2(检查项目的依赖项以及gwt编译任务带来的内容),并且没有较早的版本。