我有一个 Maven Artifact ,其中包含 GWT 模块的代码。 GwtModule.gwt.xml
的内容文件是(摘要):
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='mygwtmodule'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- Other module inherits go here -->
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>
gwt.xml
文件位于 src/main/java/my/module
,以及实现 com.google.gwt.core.client.EntryPoint
的入口点位于src/main/java/my/module/client/MyModule.java
.
然后,我在 servlet 项目中使用此代码,将另一个 Artifact 导入为我的 <dependencies>
之一。 servlet 项目有一个 src/main/resources/my/webapp/GwtWebapp.gwt.xml
文件,其中仅包含:
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='myservlet'>
<inherits name='my.module.GwtModule' />
<!-- Specify the app entry point class. -->
<entry-point class='my.module.client.MyModule' />
</module>
并且此配置多年来一直运行良好,使用 2.7.0 和 2.8.0 版本的 GWT 以及相应的 Maven 插件。
但是现在我已经升级到 Java 11,这需要 Maven GWT 2.8.2 插件,突然就失败了。仅将 GWT 版本更改为 2.8.2
在这两个项目中,运行 mvn install
在 GWT 模块上,并运行 mvn gwt:compile
在 servlet 项目中给了我:
.
.
[INFO] Compiling module my.webapp.GwtWebapp
[INFO] Ignored 1 unit with compilation errors in first pass.
[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[INFO] Finding entry point classes
[INFO] [ERROR] Hint: Check that the type name 'my.module.client.MyModule' is really what you meant
[INFO] [ERROR] Hint: Check that your classpath includes all required source roots
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
.
.
任何帮助确定此问题根源的帮助将不胜感激。
最佳答案
事实证明,由于某种原因,源文件没有包含在 .jar
中。文件。我必须明确添加:
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
<include>**/*.gwt.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
前往<build>
我的 GWT 模块的部分。
查看 .jar
由早期版本创建,似乎源代码已包含在插件中,但某些内容发生了变化,这意味着情况不再如此。
关于java - Maven GWT 模块与 GWT 2.8.2 + Java 11 中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61779604/