我一整天都在努力使用 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/