我有一个包含 3 个模块的 Maven 项目:api、gwt、web。
Web 模块创建了 war 文件,现在我有 2 个 gwt.xml 文件
client.gwt.xml,来 self 的 gwt-module。它实现了 View 、演示者、入口点
<module>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name='org.fusesource.restygwt.RestyGWT' />
<!--Specify the app entry point class. -->
<entry-point class='com.myapp.admin.client.EntryPoint'/>
<source path='rest'/>
<source path='client'/>
<source path='consts'/>
</module>
和 web.gwt.xml,来 self 的 Web 模块,应用程序应部署在其中。它继承了 gwt 模块,您可以看到 com.myapp.admin.client。
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name='com.myapp.admin.client' />
我还在 pom.xml 中添加了该模块的依赖项。但我缺少一些继承,因为:
Compiling module com.myapp.admin.web
Finding entry point classes
[ERROR] Unable to find type 'com.myapp.admin.client.EntryPoint
[ERROR] Hint: Check that the type name 'com.myapp.admin.client.EntryPoint'
[ERROR] Hint: Check that your classpath includes all required source roots
我可以跟踪跟踪,并且理解为什么 com.myapp.admin.client 中没有类路径,因为当我构建模块时,仅构建 Web 模块中的类。但我认为有了依赖和继承就足够了。感谢您的帮助。
编辑:POM.xml WEB
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
</plugin>
POM.xml 客户端
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
最佳答案
我敢打赌,您的 client
jar 不包含 *.java 源文件。 GWT 需要编译的类和源文件(主要是源文件)。
参见http://mojo.codehaus.org/gwt-maven-plugin/user-guide/library.html
关于java - GWT WebApp 寻找入口点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22835563/