maven—使用GWT2.6将Java7升级到Java8

6qftjkof  于 2021-07-13  发布在  Java
关注(0)|答案(3)|浏览(580)

在用gwt2.7将java7升级到java8时,我遇到了以下异常。有人能帮我解决这个错误吗

[ERROR] Source level must be one of [auto, 1.6, 1.7].
[ERROR] Google Web Toolkit 2.6.1
[ERROR] Compiler [-logLevel level] [-workDir dir] [-[no]compileReport] [-X[no]checkCasts] [-X[no]classMetadata] [-[no]draftCompile] [-[no]checkAssertions] [-X[no]closureCompiler] [-XfragmentCount numF
ragments] [-XfragmentMerge numFragments] [-gen dir] [-optimize level] [-[no]saveSource] [-style style] [-[no]failOnError] [-X[no]enforceStrictResources] [-[no]validateOnly] [-sourceLevel [auto, 1.6, 1
.7]] [-localWorkers count] [-war dir] [-deploy dir] [-extra dir] [-saveSourceOutput dir] module[s]
[ERROR]
[ERROR] where
[ERROR]   -logLevel                     The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL
[ERROR]   -workDir                      The compiler's working directory for internal use (must be writeable; defaults to a system temp dir)
[ERROR]   -[no]compileReport            Compile a report that tells the "Story of Your Compile". (defaults to OFF)
[ERROR]   -X[no]checkCasts              EXPERIMENTAL: Insert run-time checking of cast operations. (defaults to ON)
[ERROR]   -X[no]classMetadata           EXPERIMENTAL: Include metadata for some java.lang.Class methods (e.g. getName()). (defaults to ON)
[ERROR]   -[no]draftCompile             Compile quickly with minimal optimizations. (defaults to OFF)
[ERROR]   -[no]checkAssertions          Include assert statements in compiled output. (defaults to OFF)
[ERROR]   -X[no]closureCompiler         EXPERIMENTAL: Compile output Javascript with the Closure compiler for even further optimizations. (defaults to OFF)
[ERROR]   -XfragmentCount               EXPERIMENTAL: Limits of number of fragments using a code splitter that merges split points.
[ERROR]   -XfragmentMerge               DEPRECATED (use -XfragmentCount instead): Enables Fragment merging code splitter.
[ERROR]   -gen                          Debugging: causes normally-transient generated types to be saved in the specified directory
[ERROR]   -optimize                     Sets the optimization level used by the compiler.  0=none 9=maximum.
[ERROR]   -[no]saveSource               Enables saving source code needed by debuggers. Also see -debugDir. (defaults to OFF)
[ERROR]   -style                        Script output style: OBF[USCATED], PRETTY, or DETAILED (defaults to OBF)
[ERROR]   -[no]failOnError              Fail compilation if any input file contains an error. (defaults to OFF)
[ERROR]   -X[no]enforceStrictResources  EXPERIMENTAL: Avoid adding implicit dependencies on "client" and "public" for modules that don't define any dependencies. (defaults to OFF)
[ERROR]   -[no]validateOnly             Validate all source code, but do not compile. (defaults to OFF)
[ERROR]   -sourceLevel                  Specifies Java source level (defaults to auto:1.7)
[ERROR]   -localWorkers                 The number of local workers to use when compiling permutations
[ERROR]   -war                          The directory into which deployable output files will be written (defaults to 'war')
[ERROR]   -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 sam
e as the -extra directory/jar)
[ERROR]   -extra                        The directory into which extra files, not intended for deployment, will be written
[ERROR]   -saveSourceOutput             Overrides where source files useful to debuggers will be written. Default: saved with extras.
[ERROR] and
[ERROR]   module[s]                     Specifies the name(s) of the module(s) to compile
[INFO] ------------------------------------------------------------------------
...

gwt2.6是否与java8兼容?

dw1jzc5e

dw1jzc5e1#

[ERROR] Source level must be one of [auto, 1.6, 1.7].
[…]
[ERROR]   -sourceLevel                  Specifies Java source level (defaults to auto:1.7)

-sourceLevel1.7 (或 1.6 )明确地。
这可以通过使用 <sourceLevel>1.7</sourceLevel> 在org.codehaus的配置中。mojo:gwt-maven-plugin,或设置 maven.compiler.source 属性到 1.7 (这也将配置maven编译器插件)。看到了吗http://mojo.codehaus.org/gwt-maven-plugin/compile-mojo.html#sourcelevel 对于org.codehaus。mojo:gwt-maven-plugin.

pkmbmrz7

pkmbmrz72#

错误告诉您:
[错误]源级别必须是[auto,1.6,1.7]之一。
gwt将从2.8版开始支持java8。

igetnqfo

igetnqfo3#

如果无法升级gwt版本,则需要为项目中的编译指定源代码级别 pom.xml .

<properties>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
</properties>

相关问题