gwt - 在 Maven 中运行 GWTP 真的很痛苦

标签 gwt maven gwt-platform

我一整天都在努力使用 Maven 运行 GWTP,基本上我使用 Eclipse 插件创建了一个 GWTP gwt 应用程序。并添加了一个简单的欢迎主持人。在没有 maven 的情况下进行了尝试,并且它可以很好地从 eclipse 运行。

但是,当我将它转换为 Maven 项目(我使用的是 m2eclipse 插件)时,一切都崩溃了。所以我添加了所需的依赖项和 gwtp 依赖项:

<dependency>
    <groupId>com.google.gwt.inject</groupId>
    <artifactId>gin</artifactId>
    <version>1.5.0</version>
</dependency>

 <!-- MVP component -->
<dependency>
    <groupId>com.gwtplatform</groupId>
    <artifactId>gwtp-all</artifactId>
    <version>${gwtp.version}</version>
</dependency>   

然而,当我尝试运行它时,出现了这个错误:

Caused by: java.lang.RuntimeException: Deferred binding failed for 'com.google.gwt.event.shared.EventBus' (did you forget to inherit a required module?)

为什么很难用 maven 制作 GWTP。

最佳答案

我认为您可能缺少 gwt-user 依赖项。这是我的 GWTP 项目的 maven pom.xml:

<properties>
    <gwtVersion>2.4.0</gwtVersion>
    <gwtp.version>0.7</gwtp.version>
</properties>
<dependencies>
    <dependency>
       <groupId>com.google.gwt</groupId>
   <artifactId>gwt-user</artifactId>
   <version>${gwtVersion}</version>
   <scope>provided</scope>
</dependency>
<dependency>
    <groupId>com.gwtplatform</groupId>
    <artifactId>gwtp-mvp-client</artifactId>
    <version>${gwtp.version}</version>
    <scope>provided</scope>
</dependency>
<!-- Dispatch component -->
<dependency>
    <groupId>com.gwtplatform</groupId>
    <artifactId>gwtp-dispatch-client</artifactId>
    <version>${gwtp.version}</version>
    <scope>provided</scope> <!-- Remove for GWTP 0.5.1 and earlier -->
</dependency>
<!-- Tester component -->
<dependency>
    <groupId>com.gwtplatform</groupId>
    <artifactId>gwtp-tester</artifactId>
    <version>${gwtp.version}</version>
    <scope>test</scope>
</dependency>

如果您使用最新的 gwtp 0.7,请注意它们已从 com.google.gwt.event.shared 中的折旧类切换到 com.google.web.bindery.event .共享

参见 here了解更多详情。

关于gwt - 在 Maven 中运行 GWTP 真的很痛苦,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9392775/

相关文章:

java - GWT(P) 中的包组织

java - 客户端加密

java - 方法 synchronizedMap(HashMap<Integer,Serializable>) 对于类型 Collections 是未定义的

java - 打开项目时在 Eclipse 2018-12 中找不到自动模块

java - 如何让 ArcBees 示例 GWTP-Crawler 在 AppEngine 上运行?

design-patterns - GWT 2.1 中包含的 MVP 框架是否使其他 GWT MVP 框架变得多余?

java - 使用来自 GWT Java 的 javascript 变量

javascript - 使用 ScriptInjector GWT 注入(inject) ajax

java - 访问jar依赖的getResourceAsStream()

java - maven 中的 neo4j EmbeddedNeo4j.java try-with-resources 错误