Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
599 views
in Technique[技术] by (71.8m points)

java - Maven Compile GWT & OpenJDK 11

Recently, I am trying to switch my project to use OpenJDK 11, however the Maven build is failing because one of the GWT modules is failing to compile.

The project currently uses GWT 2.6.0, and I've tried updating to 2.8.2 if any of the newer versions is compatible with OpenJDK 11. The build is run from Eclipse IDE 4.9.0

When running with 2.6.0, the following error occurs:

Compiling module XXXXModule
[INFO]    Looking for precompiled archives.  To disable, use -Dgwt.usearchives=false
[INFO]    Loading archived module: jar:file:/C:/Users/XXXX/.m2/repository/com/google/gwt/gwt-user/2.6.0/gwt-user-2.6.0.jar!/com/google/gwt/user/User.gwtar
[INFO]    Loading archived module: jar:file:/C:/Users/XXXX/.m2/repository/com/google/gwt/gwt-user/2.6.0/gwt-user-2.6.0.jar!/com/google/gwt/core/Core.gwtar
[INFO]    Loading archived module: jar:file:/C:/Users/XXXX/.m2/repository/com/google/gwt/gwt-user/2.6.0/gwt-user-2.6.0.jar!/com/google/gwt/regexp/RegExp.gwtar
[INFO]    Loading archived module: jar:file:/C:/Users/XXXX/.m2/repository/com/google/gwt/gwt-user/2.6.0/gwt-user-2.6.0.jar!/com/google/web/bindery/event/Event.gwtar
[INFO]    Loading archived module: jar:file:/C:/Users/XXXX/.m2/repository/com/google/gwt/gwt-user/2.6.0/gwt-user-2.6.0.jar!/com/google/gwt/xml/XML.gwtar
[INFO]    Loading archived module: jar:file:/C:/Users/XXXX/.m2/repository/com/google/gwt/gwt-user/2.6.0/gwt-user-2.6.0.jar!/com/google/gwt/json/JSON.gwtar
[INFO]    Found 0 cached/archived units.  Used 0 / 0 units from cache.
[INFO]    Compiling...
[INFO]       Compilation completed in 0.00 seconds
[INFO]    Added 0 units to cache since last cleanup.
[INFO]    Validating units:
[INFO]    Removing invalidated units
[INFO]    Checked 0 dependencies for errors.
[INFO]    [ERROR] Unable to find type 'java.lang.Object'
[INFO]       [ERROR] Hint: Check that your module inherits 'com.google.gwt.core.Core' either directly or indirectly (most often by inheriting module 'com.google.gwt.user.User')
[INFO] Shutting down PersistentUnitCache thread
....
[ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.6.0:compile (default) on project tlm-war: Command [[
[ERROR] C:jdk-11.0.1injava -Xmx512M -Xss1024k -classpath .... -localWorkers 4 -XfragmentCount -1 -sourceLevel auto -gen C:UsersXXXXgitreposXXXXXXXXXXXXarget.generated XXXXModule XXXXModule XXXXModule XXXXModule

But investigating XXXXModule.gwt.xml, the file does include 'Core'

<module>
    <inherits name="com.google.gwt.user.User" />
    <inherits name="com.smartgwt.SmartGwt" />
....

I did some investigation online, and according to this answer, Migrating a GWT 2.5 web app to Java 10, I should try upgrading to GWT 2.8.2, but the build gets another issue:

[ERROR] Unexpected internal compiler error
[INFO] java.lang.SecurityException: class "org.eclipse.jdt.internal.compiler.ast.LambdaExpression"'s signer information does not match signer information of other classes in the same package
[INFO]  at java.base/java.lang.ClassLoader.checkCerts(ClassLoader.java:1150)
[INFO]  at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:905)
[INFO]  at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1014)
[INFO]  at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
[INFO]  at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
[INFO]  at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
[INFO]  at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
[INFO]  at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
[INFO]  at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
[INFO]  at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.<init>(GwtAstBuilder.java:3881)
[INFO]  at com.google.gwt.dev.jjs.impl.GwtAstBuilder.process(GwtAstBuilder.java:3970)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater$UnitProcessorImpl.process(CompilationStateBuilder.java:129)
[INFO]  at com.google.gwt.dev.javac.JdtCompiler$CompilerImpl.process(JdtCompiler.java:336)
[INFO]  at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:470)
[INFO]  at com.google.gwt.dev.javac.JdtCompiler.doCompile(JdtCompiler.java:1040)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder$CompileMoreLater.compile(CompilationStateBuilder.java:325)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.doBuildFrom(CompilationStateBuilder.java:548)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:479)
[INFO]  at com.google.gwt.dev.javac.CompilationStateBuilder.buildFrom(CompilationStateBuilder.java:465)
[INFO]  at com.google.gwt.dev.cfg.ModuleDef.getCompilationState(ModuleDef.java:423)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:222)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:202)
[INFO]  at com.google.gwt.dev.Precompile.precompile(Precompile.java:143)
[INFO]  at com.google.gwt.dev.Compiler.compile(Compiler.java:204)
[INFO]  at com.google.gwt.dev.Compiler.compile(Compiler.java:155)
[INFO]  at com.google.gwt.dev.Compiler.compile(Compiler.java:144)
[INFO]  at com.google.gwt.dev.Compiler$1.run(Compiler.java:118)
[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:125)      

Has anyone else been successful in compiling GWT 2.6-2.8.2 with OpenJDK 11?

EDIT:

Snippet of pom.xml

....
<properties>
  <gwt.version>2.8.2</gwt.version>
  <smartgwt.version>2.4</smartgwt.version>
</properties>
....

<build>
<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>${gwt.version}</version>
    <executions>
      <execution>
        <configuration>
          <modules>
            <module>XXXXModule</module>
            <module>XXXXModule</module>
            <module>XXXXModule</module>
            <module>XXXXModule</module>
          </modules>
          <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
          <logLevel>DEBUG</logLevel>
        </configuration>
        <goals>
          <goal>compile</goal>
          <goal>test</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
</plugins>

Classpath:

C:UsersXXXX.m2
epositorycomgooglegwtgwt-servlet2.8.2gwt-servlet-2.8.2.jar
C:UsersXXXX.m2
epositorycomgooglegwtgwt-user2.8.2gwt-user-2.8.2.jar
C:UsersXXXX.m2
epositorycomgooglejsinteropjsinterop-annotations1.0.2jsinterop-annotations-1.0.2.jar
C:UsersXXXX.m2
epositorycomgooglejsinteropjsinterop-annotations1.0.2jsinterop-annotations-1.0.2-sources.jar
C:UsersXXXX.m2
epositoryjavaxvalidationvalidation-api1.0.0.GAvalidation-api-1.0.0.GA.jar
C:UsersXXXX.m2
epositoryjavaxvalidationvalidation-api1.0.0.GAvalidation-api-1.0.0.GA-sources.jar
C:UsersXXXX.m2
epositoryjavaxservletjavax.servlet-api3.0.1javax.servlet-api-3.0.1.jar
C:UsersXXXX.m2
epositoryorgw3ccsssac1.3sac-1.3.jar
C:UsersXXXX.m2
epositorycomsmartgwtsmartgwt2.4smartgwt-2.4.jar
C:UsersXXXX.m2
epositorycomsmartgwtsmartgwt-skins2.4smartgwt-skins-2.4.jar
C:UsersXXXX.m2
epositoryorgslf4jslf4j-api1.7.6slf4j-api-1.7.6.jar
C:UsersXXXX.m2
epositoryorgslf4jjcl-over-slf4j1.7.6jcl-over-slf4j-1.7.6.jar
C:UsersXXXX.m2
epositoryorgslf4jlog4j-over-slf4j1.7.6log4j-over-slf4j-1.7.6.jar
C:UsersXXXX.m2
epositorychqoslogbacklogback-classic1.1.1logback-classic-1.1.1.jar
C:UsersXXXX.m2
epositorychqoslogbacklogback-core1.1.1logback-core-1.1.1.jar
C:UsersXXXX.m2
epositorycommons-codeccommons-codec1.9commons-codec-1.9.jar
C:UsersXXXX.m2
epositorycommons-loggingcommons-logging1.2commons-logging-1.2.jar
C:UsersXXXX.m2
epositoryorgjasyptjasypt1.9.2jasypt-1.9.2.jar
C:UsersXXXX.m2
epositoryorghibernatehibernate-core4.3.5.Finalhibernate-core-4.3.5.Final.jar
C:UsersXXXX.m2
epositoryorgjbossloggingjboss-logging3.1.3.GAjboss-logging-3.1.3.GA.jar
C:UsersXXXX.m2
epositoryorgjbossloggingjboss-logging-annotations1.2.0.Beta1jboss-logging-annotations-1.2.0.Beta1.jar
C:UsersXXXX.m2
epositoryorgjbossspecjavaxransactionjboss-transaction-api_1.2_spec1.0.0.Finaljboss-transaction-api_1.2_spec-1.0.0.Final.jar
C:UsersXXXX.m2
epositorydom4jdom4j1.6.1dom4j-1.6.1.jar
C:UsersXXXX.m2
epositoryxml-apisxml-apis1.0.b2xml-apis-1.0.b2.jar
C:UsersXXXX.m2
epositoryorghibernatecommonhibernate-commons-annotations4.0.4.Finalhibernate-commons-annotations-4.0.4.Final.jar
C:UsersXXXX.m2
epositoryorghibernatejavaxpersistencehibernate-jpa-2.1-api1.0.0.Finalhibernate-jpa-2.1-api-1.0.0.Final.jar
C:UsersXXXX.m2
epositoryantlrantlr2.7.7antlr-2.7.7.jar
C:UsersXXXX.m2
epositoryorgjbossjandex1.1.0.Finaljandex-1.1.0.Final.jar
C:UsersXXXX.m2
epositoryorghibernatehibernate-jpamodelgen4.3.5.Finalhibernate-jpamodelgen-4.3.5.Final.jar
C:UsersXXXX.m2
epositoryorghibernatehibernate-tools4.3.1.CR1hibernate-tools-4.3.1.CR1.jar
C:UsersXXXX.m2
epositoryorghibernatehibernate-entitymanager4.3.1.Finalhibernate-entitymanager-4.3.1.Final.jar
C:UsersXXXX.m2
epositoryjavaxransactionjta1.1jta-1.1.jar
C:UsersXXXX.m2
epositoryfreemarkerfreemarker2.3.8freemarker-2.3.8.jar
C:UsersXXXX.m2
epositoryorghibernatejtidy
8-20060801jtidy-r8-20060801.jar
C:UsersXXXX.m2
epositoryorgeclipseychoorg.eclipse.jdt.core3.9.1.v20130905-0837org.eclipse.jdt.core-3.9.1.v20130905-0837.jar
C:UsersXXXX.m2
epositoryorgeclipseext3.3.0-v20070606-0010ext-3.3.0-v20070606-0010.jar
C:UsersXXXX.m2
epositoryorgeclipsecorecommands3.3.0-I20070605-0010commands-3.3.0-I20070605-0010.jar
C:UsersXXXX.m2
epositoryorgeclipseequinoxcommon3.6.200-v20130402-1505common-3.6.200-v20130402-1505.jar
C:UsersXXXX.m2
epositoryorgspringframeworkspring-context3.2.9.RELEASEspring-context-3.2.9.RELEASE.jar
C:UsersXXXX.m2
epositoryorgspringframeworkspring-aop3.2.9.RELEASEspring-aop-3.2.9.RELEASE.jar
C:UsersXXXX.m2
epositoryaopallianceaopalliance1.0aopalliance-1.0.jar
C:UsersXXXX.m2
epositoryorgspringframeworkspring-beans3.2.9.RELEASEspring-beans-3.2.9.RELEASE.jar
C:UsersXXXX.m2
epositoryorgspringframeworkspring-expression3.2.9.RELEASEspring-expression-3.2.9.RELEASE.jar
C:UsersXXXX.m2
epositoryorgspringframeworkspring-jdbc3.2.9.RELEASEspring-jdbc-3.2.9.RELEASE.jar
C:UsersXXXX.m2
epositoryorgspringframeworkspring-tx3.2.9.RELEASEspring-tx-3.2.9.RELEASE.jar
C:UsersXXXX.m2
epositoryorgspringframeworkspring-core3.2.9.RELEASEspring-core-3.2.9.RELEASE.jar
C:UsersXXXX.m2
epositoryorgspringframeworkspring-orm3.2.9.RELEASEspring-orm-3.2.9.RELEASE.jar
C:UsersXXXX.m2
epositorycomoraclejdbcojdbc611.2.0.3.0ojdbc6-11.2.0.3.0.jar
C:UsersXXXX.m2
epositorycomoracleucpucp11.2.0.3.0ucp-11.2.0.3.0.jar
C:UsersXXXX.m2
epositorycommysemaquerydslquerydsl-sql2.8.2querydsl-sql-2.8.2.jar
C:UsersXXXX.m2
epositorycommysemaquerydslquerydsl-core2.8.2querydsl-core-2.8.2.jar
C:UsersXXXX.m2
epositorycomgoogleguavaguava11.0.2guava-11.0.2.jar
C:UsersXXXX.m2
epositorycomgooglecodefindbugsjsr3051.3.9jsr305-1.3.9.jar
C:UsersXXXX.m2
epositorycommysemacommonsmysema-commons-lang.2.4mysema-common

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

GWT 2.8.2 works with openjdk11. Here you can see that the tbroyer gwt-maven-plugin works with openjdk8 and openjdk11 using both last GWT release (version 2.8.2) and last development commit (version HEAD-SNAPSHOT).

So, you really should upgrade to GWT 2.8.2. GWT only support the last version. Usually upgrading between version is trivial because almost no API changes have been made for years and only bug fixes and new java language support has been added. It should be quite easy.

In your case, it seems to be a dependency problem, maybe because some of your dependencies have a dependency on the old version of GWT itself. To avoid dependencies conflicts it is recommended to use the BOM dependency. This tutorial includes a minimal explanation of why and how to use the GWT BOM dependency. Essentially, add this in your root project pom.xml:

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt</artifactId>
        <version>2.8.2</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...