I am trying to upgrade my game to libGDX 1.9.5. The game works fine on desktop, but when I try to build the HTML version I get the following error:
Configuration on demand is an incubating feature.
:core:compileJava UP-TO-DATE
:core:processResources UP-TO-DATE
:core:classes UP-TO-DATE
:core:jar UP-TO-DATE
:html:compileJava UP-TO-DATE
:html:processResources UP-TO-DATE
:html:classes UP-TO-DATE
:html:addSource
:html:compileGwt
Loading inherited module 'tech.otter.merchant.GdxDefinition'
Loading inherited module 'com.badlogic.gdx.backends.gdx_backends_gwt'
Loading inherited module 'com.google.gwt.user.User'
Loading inherited module 'com.google.gwt.media.Media'
Loading inherited module 'com.google.gwt.user.UI'
Loading inherited module 'com.google.gwt.uibinder.UiBinder'
[ERROR] Line 20: Unexpected element 'resource'
[ERROR] Failure while parsing XML
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.util.xml.DefaultSchema.onUnexpectedElement(DefaultSchema.java:86)
Historically, the biggest challenges for me when using GWT have been VisUI and gdx-kiwi, but I have gone to their wikis and updated their versions in my gradle files shown below:
/build.gradle
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
}
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
classpath 'com.android.tools.build:gradle:2.2.0'
classpath "com.badlogicgames.gdx:gdx-tools:1.9.4"
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.1'
ext {
appName = "merchant"
gdxVersion = '1.9.5'
roboVMVersion = '2.2.0'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
kiwiVersion = '1.8.1.9.4'
visVersion = '1.3.0-SNAPSHOT'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
compile "com.github.czyzby:gdx-kiwi:$kiwiVersion"
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
}
}
project(":html") {
apply plugin: "gwt"
apply plugin: "war"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion:sources"
compile "com.github.czyzby:gdx-kiwi:$kiwiVersion:sources"
compile "com.kotcrab.vis:vis-ui:$visVersion:sources"
}
}
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:$aiVersion"
compile "com.github.czyzby:gdx-kiwi:$kiwiVersion"
compile "com.kotcrab.vis:vis-ui:$visVersion"
}
}
tasks.eclipse.doLast {
delete ".project"
}
html/build.gradle
apply plugin: "java"
apply plugin: "jetty"
gwt {
gwtVersion='2.6.1' // Should match the gwt version used for building the gwt backend
maxHeapSize="1G" // Default 256m is not enough for gwt compiler. GWT is HUNGRY
minHeapSize="1G"
src = files(file("src/")) // Needs to be in front of "modules" below.
modules 'tech.otter.merchant.GdxDefinition'
devModules 'tech.otter.merchant.GdxDefinitionSuperdev'
project.webAppDirName = 'webapp'
compiler {
strict = true;
enableClosureCompiler = true;
disableCastChecking = true;
}
}
task draftRun(type: JettyRunWar) {
dependsOn draftWar
dependsOn.remove('war')
webApp=draftWar.archivePath
daemon=true
}
task superDev(type: de.richsource.gradle.plugins.gwt.GwtSuperDev) {
dependsOn draftRun
doFirst {
gwt.modules = gwt.devModules
}
}
task dist(dependsOn: [clean, compileGwt]) {
doLast {
file("build/dist").mkdirs()
copy {
from "build/gwt/out"
into "build/dist"
}
copy {
from "webapp"
into "build/dist"
}
copy {
from "war"
into "build/dist"
}
delete "../../madigan.github.io/merchant/"
copy {
from "build/dist"
into "../../madigan.github.io/merchant/"
}
doGit
}
}
task doGit(type: Exec) {
commandLine 'git', '-C', '../../madigan.github.io', 'add', '.'
commandLine 'git', '-C', '../../madigan.github.io', 'commit', '-m', '"Distribution."'
commandLine 'git', '-C', '../../madigan.github.io', 'push'
}
draftWar {
from "war"
}
task addSource << {
sourceSets.main.compileClasspath += files(project(':core').sourceSets.main.allJava.srcDirs)
}
tasks.compileGwt.dependsOn(addSource)
tasks.draftCompileGwt.dependsOn(addSource)
sourceCompatibility = 1.8
sourceSets.main.java.srcDirs = [ "src/" ]
eclipse.project {
name = appName + "-html"
}
Any advice or tips on how to troubleshoot this error would be much appreciated.
[EDIT]
I read the release notes a little closer, and it says that I should change the GWT version to 2.8.0. Even when I do this, I still get the following error:
Configuration on demand is an incubating feature.
:core:compileJava UP-TO-DATE
:core:processResources UP-TO-DATE
:core:classes UP-TO-DATE
:core:jar UP-TO-DATE
:html:compileJava UP-TO-DATE
:html:processResources UP-TO-DATE
:html:classes UP-TO-DATE
:html:addSource
:html:compileGwt
Unknown argument: -XenableClosureCompiler
Google Web Toolkit 2.8.0
Compiler [-logLevel (ERROR|WARN|INFO|TRACE|DEBUG|SPAM|ALL)] [-workDir dir] [-X[no]closureFormattedOutput] [-[no]compileReport] [-X[no]checkCasts] [-X[no]classMetadata] [-[no]draftCompile] [-[no]checkAssertions] [-XfragmentCount numFragments] [-XfragmentMerge numFragments] [-gen dir] [-[no]generateJsInteropExports] [-XmethodNameDisplayMode (NONE|ONLY_METHOD_NAME|ABBREVIATED|FULL)] [-Xnamespace (NONE|PACKAGE)] [-optimize level] [-[no]saveSource] [-setProperty name=value,value...] [-style (DETAILED|OBFUSCATED|PRETTY)] [-[no]failOnError] [-[no]validateOnly] [-sourceLevel [auto, 1.8]] [-localWorkers count] [-[no]incremental] [-war dir] [-deploy dir] [-extra dir] [-saveSourceOutput dir] module[s]
where
-logLevel The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM or ALL (defaults to INFO)
-workDir The compiler's working directory for internal use (must be writeable; defaults to a system temp dir)
-X[no]closureFormattedOutput EXPERIMENTAL: Enables Javascript output suitable for post-compilation by Closure Compiler (defaults to OFF)
-[no]compileReport Compile a report that tells the "Story of Your Compile". (defaults to OFF)
-X[no]checkCasts EXPERIMENTAL: DEPRECATED: use jre.checks.checkLevel instead. (defaults to OFF)
-X[no]classMetadata EXPERIMENTAL: Include metadata for some java.lang.Class methods (e.g. getName()). (defaults to ON)
-[no]draftCompile Compile quickly with minimal optimizations. (defaults to OFF)
-[no]checkAssertions Include assert statements in compiled output. (defaults to OFF)
-XfragmentCount EXPERIMENTAL: Limits of number of fragments using a code splitter that merges split points.
-XfragmentMerge DEPRECATED (use -XfragmentCount instead): Enables Fragment merging code splitter.
-gen Debugging: causes normally-transient generated types to be saved in the specified directory
-[no]generateJsInteropExports Generate exports for JsInterop purposes (defaults to OFF)
-XmethodNameDisplayMode EXPERIMENTAL: Specifies method display name mode for chrome devtools: NONE, ONLY_METHOD_NAME, ABBREVIATED or FULL (defaults to NONE)
-Xnamespace Puts most JavaScript globals into namespaces. Default: PACKAGE for -draftCompile, otherwise NONE
-optimize Sets the optimization level used by the compiler. 0=none 9=maximum.
-[no]saveSource Enables saving source code needed by debuggers. Also see -debugDir. (defaults to OFF)
-setProperty Set the values of a property in the form of propertyName=value1[,value2...].
-style Script output style: DETAILED, OBFUSCATED or PRETTY (defaults to OBFUSCATED)
-[no]failOnError Fail compilation if any input file contains an error. (defaults to ON)
-[no]validateOnly Validate all source code, but do not compile. (defaults to OFF)
-sourceLevel Specifies Java source level (defaults to 1.8)
-localWorkers The number of local workers to use when compiling permutations
-[no]incremental Compiles faster by reusing data from the previous compile. (defaults to OFF)
-war The directory into which deployable output files will be written (defaults to 'war')
-deploy The directory into which deployable but not servable output files will be written (defaults to 'WEB-INF/deploy' under the -war directory/jar, and may be the same as the -extra directory/jar)
-extra The directory into which extra files, not intended for deployment, will be written
-saveSourceOutput Overrides where source files useful to debuggers will be written. Default: saved with extras.
and
module[s] Specifies the name(s) of the module(s) to compile
:html:compileGwt FAILED
[EDIT #2]
Now that the flag is removed per @Colin Altworth's answer, I get the following error particular to vis-ui (again, updated to use the recommended version for libGDX 1.9.5):
:html:compileGwt
Compiling module tech.otter.merchant.GdxDefinition
Tracing compile failure path for type 'com.kotcrab.vis.ui.util.async.AsyncTask'
[ERROR] Errors in 'jar:file:/home/john/.gradle/caches/modules-2/files-2.1/com.kotcrab.vis/vis-ui/1.3.0-SNAPSHOT/e5f8abbdc3524212158f65d63c9a28d226795f97/vis-ui-1.3.0-SNAPSHOT-sources.jar!/com/kotcrab/vis/ui/util/async/AsyncTask.java'
[ERROR] Line 46: The constructor Thread(new Runnable(){}, String) is undefined
[ERROR] Line 51: The method start() is undefined for the type Thread
[ERROR] Aborting compile due to errors in some input files
:html:compileGwt FAILED
FAILURE: Build failed with an exception.
[EDIT #3]
Turns out the rest of the issue was a bug in VisUI- the latest update tries to use the Thread class, which is not supported by GWT.
Remove the closure flag from your gradle GWT build:
GWT no longer supports this experimental flag.