问题
I know other people have had issues with GWT compiles, but in this case I am at a loss. I am using GWT 2.6.1 and the same version of the gwt-maven-plugin, 2.6.1
First does GWT and/or SmartGWT support JDK 1.8 yet, or just 1.7 for now? I am using jdk 1.7, but would like to try 1.8 eventually.
Second, when I do a maven build within eclipse I get this error ... Yet, when I do a GWT compile from the GWT Eclipse Plugin, I right click on the project, and I tell it to GWT Compile and it does with no issues.
[INFO] --- gwt-maven-plugin:2.6.1:compile (default) @ rm-ui ---
[INFO] auto discovered modules [com.redi2.products.rm.RevenueManager]
[INFO] Compiling module com.redi2.products.rm.RevenueManager
[INFO] [ERROR] Unexpected internal compiler error
[INFO] java.lang.NoSuchFieldError: warningThreshold
[INFO] at com.google.gwt.dev.javac.JdtCompiler$1.<init>(JdtCompiler.java:505)
[INFO] at com.google.gwt.dev.javac.JdtCompiler.getStandardCompilerOptions(JdtCompiler.java:503)
[INFO] at com.google.gwt.dev.javac.JdtCompiler.getCompilerOptions(JdtCompiler.java:533)
[INFO] at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:878)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:284)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:511)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:434)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:420)
[INFO] at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:495)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:241)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:223)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:139)
[INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:167)
[INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:132)
[INFO] at com.google.gwt.dev.Compiler$1.run(Compiler.java:99)
[INFO] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55)
[INFO] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)
[INFO] at com.google.gwt.dev.Compiler.main(Compiler.java:106)
The next step was to go out of eclipse and try a mvn build from the command line, and that doesn't work. So, I do the following:
mvn clean - and that correctly deletes my target directory and the gwt-unitCache.
mvn gwt:clean
mvn -X -e gwt:compile --debug
At first, it was telling me that it couldn't find my: com.tholmes.products.App.gwt.xml but I know it is there, I even deleted the file and re-added it. It is very much part of the classpath, and it is there, and in the right format.
so, I did a:
mvn gwt:eclipse
mvn gwt:eclipseTest
This seemed to fix the issue that it could not find the gwt.xml file.
So, now I try again, and this is what I get with all the debug and stack trace.
[INFO] Compiling module com.redi2.products.rm.RevenueManager
[INFO] [ERROR] Unexpected internal compiler error
[INFO] java.lang.NoSuchFieldError: warningThreshold
[INFO] at com.google.gwt.dev.javac.JdtCompiler$1.<init>(JdtCompiler.java:505)
[INFO] at com.google.gwt.dev.javac.JdtCompiler.getStandardCompilerOptions(JdtCompiler.java:503)
[INFO] at com.google.gwt.dev.javac.JdtCompiler.getCompilerOptions(JdtCompiler.java:533)
[INFO] at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:878)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:284)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:511)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:434)
[INFO] at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:420)
[INFO] at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:495)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:241)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:223)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:139)
[INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:167)
[INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:132)
[INFO] at com.google.gwt.dev.Compiler$1.run(Compiler.java:99)
[INFO] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55)
[INFO] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)
[INFO] at com.google.gwt.dev.Compiler.main(Compiler.java:106)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.522s
[INFO] Finished at: Fri Sep 05 11:00:36 EDT 2014
[INFO] Final Memory: 15M/222M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.6.1:compile (default-cli) on project rm-ui: Command [[
then there is a huge classpath here ending with:
...\tholmes\.m2\repository\com\google\gwt\gwt-dev\2.6.1\gwt-dev-2.6.1.jar
com.google.gwt.dev.Compiler -logLevel INFO -style OBF -war C:\Users\tholmes\git\rm_ui
\target\rm-ui-0.0.1-SNAPSHOT -localWorkers 4 -XfragmentCount -1 -sourceLevel auto -gen C:\Users\tholmes\git\rm_ui\target\.generated com.redi2.products.rm.RevenueManager
]] failed with status 1 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357)
then it says:
Caused by: org.codehaus.mojo.gwt.shell.ForkedProcessExecutionException: Command [[
with a huge class path, and finally ending with ...
...\tholmes.m2\repository\com\google\gwt\gwt-dev\2.6.1\gwt-dev-2.6.1.jar com.google.gwt.dev.Compiler
-logLevel INFO -style OBF
-war C:\Users\tholmes\git\rm_ui\target\rm-ui-0.0.1-SNAPSHOT
-localWorkers 4 -XfragmentCount -1
-sourceLevel auto
-gen C:\Users\tholmes\git\rm_ui\target.generated com.redi2.products.rm.RevenueManager
]] failed with status 1
at
org.codehaus.mojo.gwt.shell.AbstractGwtShellMojo$JavaCommand.execute(AbstractGwtShellMojo.java:485)
at org.codehaus.mojo.gwt.shell.CompileMojo.compile(CompileMojo.java:446)
at org.codehaus.mojo.gwt.shell.CompileMojo.doExecute(CompileMojo.java:351)
at org.codehaus.mojo.gwt.shell.AbstractGwtShellMojo.execute(AbstractGwtShellMojo.java:172)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I've spent two days, and going on three trying to figure this out.
This is a project we have in our local git, and I'd rather not have to revuild a new UI project from scratch.
Thanks!
回答1:
First does GWT and/or SmartGWT support JDK 1.8 yet, or just 1.7 for now? I am using jdk 1.7, but would like to try 1.8 eventually.
The GWT Compiler in 2.6 does not support Java 1.8. The current version of GWT in git does not either, but there is a fork being maintained that adds support. Extremely short version of the issues: The language features themselves aren't too bad too add (and the described fork already has them), but the new JRE library features need to be ported too (and legally! can't just copy from Oracle's code, that way lies lawsuits).
java.lang.NoSuchFieldError: warningThreshold
Two possible issues can cause this, both classpath related.
The first is a gwt version issue - you are somehow mixing and matching versions of GWT on your classpath. Look through the full (but not included in this question, so I can't give you more specifics), and you'll likely find an extra copy of GWT 2.5 or 2.4 somewhere listed. I suspect this is the most likely since it tends to be specific to your GWT upgrade.
Another option is that you have another (very likely older) JDT on your classpath somewhere (since GWT 2.6 updated to a new JDT version). See related question GWT + Spring hosted mode not working - this is talking about dev mode, but it is the same idea. This seems less likely to me since you should be using the same classpath whether in eclipse or maven, but is still possible.
来源:https://stackoverflow.com/questions/25689458/gwt-2-6-1-unknown-compile-issue