tbroyer / gwt-maven-plugin

Starting fresh on building GWT projects with Maven
https://tbroyer.github.io/gwt-maven-plugin/
Apache License 2.0
167 stars 39 forks source link

OpenJDK 11 breaks the plugin #122

Closed pedy711 closed 5 years ago

pedy711 commented 5 years ago

Hi, after switching from JDK 1.8 to OpenJDK 11, I get the following error:

1 com.jdisc.mdm.SpringBootSmartGwtOpenJdk11.app [WARNING] Source level must be one of [auto, 1.8]. [WARNING] Google Web Toolkit 2.8.2 [WARNING] 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 numFrag ments] [-gen dir] [-[no]generateJsInteropExports] [-includeJsInteropExports/excludeJsInteropExports regex] [-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]incremen tal] [-war dir] [-deploy dir] [-extra dir] [-saveSourceOutput dir] module[s] [WARNING] [WARNING] where [WARNING] -logLevel The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM or ALL (d efaults to INFO) [WARNING] -workDir The compiler's working directory for internal use (must be writeable; defaul ts to a system temp dir) [WARNING] -X[no]closureFormattedOutput EXPERIMENTAL: Enables Javascript output suitable for post-compilation by Clo sure Compiler (defaults to OFF) [WARNING] -[no]compileReport Compile a report that tells the "Story of Your Compile". (defaults to OFF) [WARNING] -X[no]checkCasts EXPERIMENTAL: DEPRECATED: use jre.checks.checkLevel instead. (defaults to OF F) [WARNING] -X[no]classMetadata EXPERIMENTAL: Include metadata for some java.lang.Class methods (e.g. getNam e()). (defaults to ON) [WARNING] -[no]draftCompile Compile quickly with minimal optimizations. (defaults to OFF) [WARNING] -[no]checkAssertions Include assert statements in compiled output. (defaults to OFF) [WARNING] -XfragmentCount EXPERIMENTAL: Limits of number of fragments using a code splitter that merge s split points. [WARNING] -XfragmentMerge DEPRECATED (use -XfragmentCount instead): Enables Fragment merging code spli tter. [WARNING] -gen Debugging: causes normally-transient generated types to be saved in the spec ified directory [WARNING] -[no]generateJsInteropExports Generate exports for JsInterop purposes. If no -includeJsInteropExport/-excl udeJsInteropExport provided, generates all exports. (defaults to OFF) [WARNING] -includeJsInteropExports/excludeJsInteropExports Include/exclude members and classes while generating JsInterop exports. Flag could be set multiple times to expand the pattern. (The flag has only effect if exporting is enabled via -generateJsInteropExports) [WARNING] -XmethodNameDisplayMode EXPERIMENTAL: Specifies method display name mode for chrome devtools: NONE, ONLY_METHOD_NAME, ABBREVIATED or FULL (defaults to NONE) [WARNING] -Xnamespace Puts most JavaScript globals into namespaces. Default: PACKAGE for -draftCom pile, otherwise NONE [WARNING] -optimize Sets the optimization level used by the compiler. 0=none 9=maximum. [WARNING] -[no]saveSource Enables saving source code needed by debuggers. Also see -debugDir. (default s to OFF) [WARNING] -setProperty Set the values of a property in the form of propertyName=value1[,value2...].

[WARNING] -style Script output style: DETAILED, OBFUSCATED or PRETTY (defaults to OBFUSCATED)

[WARNING] -[no]failOnError Fail compilation if any input file contains an error. (defaults to OFF) [WARNING] -[no]validateOnly Validate all source code, but do not compile. (defaults to OFF) [WARNING] -sourceLevel Specifies Java source level (defaults to 1.8) [WARNING] -localWorkers The number of local workers to use when compiling permutations [WARNING] -[no]incremental Compiles faster by reusing data from the previous compile. (defaults to OFF)

[WARNING] -war The directory into which deployable output files will be written (defaults t o 'war') [WARNING] -deploy The directory into which deployable but not servable output files will be wr itten (defaults to 'WEB-INF/deploy' under the -war directory/jar, and may be the same as the -extra directory/jar) [WARNING] -extra The directory into which extra files, not intended for deployment, will be w ritten [WARNING] -saveSourceOutput Overrides where source files useful to debuggers will be written. Default: s aved with extras. [WARNING] and [WARNING] module[s] Specifies the name(s) of the module(s) to compile [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 6.487 s [INFO] Finished at: 2018-11-13T12:25:38+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal net.ltgt.gwt.maven:gwt-maven-plugin:1.0-rc-10:compile (default) on project SpringBootSmartGwtOpenJdk11: GWT exited with status 1 -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.ltgt.gwt.maven:gwt-maven-plugin:1.0-rc-10:compile (defa ult) on project SpringBootSmartGwtOpenJdk11: GWT exited with status 1 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:355) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:200) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: GWT exited with status 1 at net.ltgt.gwt.maven.CommandLine.execute (CommandLine.java:50) at net.ltgt.gwt.maven.CompileMojo.execute (CompileMojo.java:202) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:355) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:200) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356) [ERROR]

tbroyer commented 5 years ago

The error seems clear enough to me:

[WARNING] Source level must be one of [auto, 1.8].

And the source level defaults to ${maven.compiler.source} (https://tbroyer.github.io/gwt-maven-plugin/compile-mojo.html#sourceLevel), so it might be that you changed either <sourceLevel> of the plugin, or the maven.compiler.source property.

Run Maven with debug logs (mvn -X) to better understand what's going on, and what value is actually passed to GWT as -sourceLevel.

That being said, note that gwt:test won't work with JDK 11 yet: https://github.com/tbroyer/gwt-maven-plugin/commit/644941dc7628986b717c59ea8737001a8dc36201 (notice that this commit is not in any release yet)

pedy711 commented 5 years ago

Thanks Thomas for your help. Your answer was very helpful. I had actually set maven.compiler.source to 11 because without it the compiler would complain about the following: Source option 5 is no longer supported. Use 6 or later. [ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.

But then removed both maven.compiler.source and 11 from pom.xml and only add the following which let maven-compiler-plugin to take care of the versioning itself:

<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version> <!-- or whatever current version -->
        <configuration>
          <source>11</source>
          <target>11</target>
        </configuration>
      </plugin>
    </plugins>
</build>
tbroyer commented 5 years ago

Be careful though, GWT 2.8.2 only supports Java 8 sources, so you'd better use <maven.compiler.source>8</maven.compiler.source> in your GWT and/or shared modules, and keep maven-compiler-plugin and gwt-maven-plugin aligned that way. Feel free to use Java 11 on the server-side though (with var type inference, private methods on interfaces, et al.)