添加 gwteventservice 作为 Maven 依赖中断项目
Adding gwteventservice as Maven dependency breaks project
我有一个相当大的 GWT 应用程序,我想试用 gwteventservice。为此,我从 Maven Repository Page:
中获取了 1.2.1 版本的依赖
<dependency>
<groupId>de.novanic.gwteventservice</groupId>
<artifactId>eventservice</artifactId>
<version>1.2.1</version>
</dependency>
将它添加到我的 pom.xml
后,更新 Maven 依赖项并清理我的项目,突然出现一大堆编译器错误。
我从 Eclipse 中的 "Problems" 选项卡复制了相关消息(每行都是一个单独的条目):
The method setCellStyleNames(String) is undefined for the type Column<T,capture#5-of ?>
The constructor SimplePager(SimplePager.TextLocation, boolean, int, boolean) is undefined
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
The method getSafeUri() is undefined for the type ImageResource GameSearchTable.java
The method getSafeUri() is undefined for the type ImageResource GameSearchTable.java
The method getSafeUri() is undefined for the type ImageResource GameSearchTable.java
The method getSafeUri() is undefined for the type ImageResource GameSearchTable.java
The method getSafeUri() is undefined for the type ImageResource GameSearchTable.java
The method setSortable(boolean) is undefined for the type GameSearchTable.RatingColumn
The method setSortable(boolean) is undefined for the type GameSearchTable.StatusColumn
The method setSortable(boolean) is undefined for the type TextColumn<GameDTO>
The method setSortable(boolean) is undefined for the type TextColumn<GameDTO>
The type GameSearchTable.RatingCell must implement the inherited abstract method AbstractCell<GameDTO>.render(GameDTO, Object, SafeHtmlBuilder)
The type GameSearchTable.StatusCell must implement the inherited abstract method AbstractCell<GameDTO>.render(GameDTO, Object, SafeHtmlBuilder)
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method setSortable(boolean) is undefined for the type GameTable.RatingColumn
The method setSortable(boolean) is undefined for the type GameTable.StatusColumn
The method setSortable(boolean) is undefined for the type TextColumn<GameDTO>
The type GameTable.RatingCell must implement the inherited abstract method AbstractCell<GameDTO>.render(GameDTO, Object, SafeHtmlBuilder)
The type GameTable.StatusCell must implement the inherited abstract method AbstractCell<GameDTO>.render(GameDTO, Object, SafeHtmlBuilder)
The constructor ActivityManager(ActivityMapper, EventBus) is undefined
The method register(com.google.gwt.place.shared.PlaceController, com.google.gwt.event.shared.EventBus, com.google.gwt.place.shared.Place) in the type PlaceHistoryHandler is not applicable for the arguments (com.google.gwt.place.shared.PlaceController, com.google.web.bindery.event.shared.EventBus, com.google.gwt.place.shared.Place)
The constructor PlaceController(EventBus) is undefined
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
Context cannot be resolved to a type
Context cannot be resolved to a type
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method setSortable(boolean) is undefined for the type PlatformTable.ProgressBarColumn
The method setSortable(boolean) is undefined for the type PlatformTable.RatingColumn
The method setSortable(boolean) is undefined for the type PlatformTable.StatusColumn
The method setSortable(boolean) is undefined for the type TextColumn<PlatformDTO>
The type PlatformTable.ProgressBarCell must implement the inherited abstract method AbstractCell<PlatformDTO>.render(PlatformDTO, Object, SafeHtmlBuilder)
The type PlatformTable.RatingCell must implement the inherited abstract method AbstractCell<PlatformDTO>.render(PlatformDTO, Object, SafeHtmlBuilder)
The type PlatformTable.StatusCell must implement the inherited abstract method AbstractCell<PlatformDTO>.render(PlatformDTO, Object, SafeHtmlBuilder)
The method setWidget(int, int, Widget) in the type HTMLTable is not applicable for the arguments (int, int, IsWidget)
The method setWidget(int, int, Widget) in the type HTMLTable is not applicable for the arguments (int, int, IsWidget)
有趣的是,这些只出现在代码的 客户端 上。如果没有添加依赖项,我的应用程序可以正常编译。
我的环境:
- Java1.7.0_55
- GWT 2.6.0
- 行家 3.3.1
到目前为止我试过什么都没有成功:
- 在我的
pom.xml
中使用较早版本 (1.2.0) 的 gwteventservice
- Eclipse 建议快速修复以将
gwt-user.jar
添加到我的构建路径
- 正在将依赖项
gwt-user
添加到我的 pom.xml
- 将相关的外部 jar 直接添加到我的构建路径(这是唯一有效的方法,但我真的不喜欢这个解决方案......我宁愿把所有东西都放在我的
pom.xml
)
所以问题是:
- 为什么添加依赖项会破坏我的项目并且
- 我该如何解决这个问题?
如果没有其他帮助,我可能会考虑 gwt-comet
。
如您所见,gwteventservice
依赖于 gwt 2.1.0 here。我认为您不能将它与 GWT 2.6.0 一起使用。
尝试排除从事件服务传递继承的依赖项。
<dependencies>
....
<dependency>
<groupId>de.novanic.gwteventservice</groupId>
<artifactId>eventservice</artifactId>
<version>1.2.1</version>
<exclusions>
<exclusion>
<artifactId>gwt-servlet</artifactId>
<groupId>com.google.gwt</groupId>
</exclusion>
<exclusion>
<artifactId>gwt-user</artifactId>
<groupId>com.google.gwt</groupId>
</exclusion>
</exclusion>
</dependency>
<dependency>
<artifactId>gwt-user</artifactId>
<groupId>com.google.gwt</groupId>
<version>2.6.0</version>
</dependency>
<dependency>
<artifactId>gwt-servlet</artifactId>
<groupId>com.google.gwt</groupId>
<version>2.6.0</version>
</dependency>
....
</dependencies>
但是你需要为它们提供依赖项(即使你不需要它们),而 eventservice
会寻找它们。
我有一个相当大的 GWT 应用程序,我想试用 gwteventservice。为此,我从 Maven Repository Page:
中获取了 1.2.1 版本的依赖<dependency>
<groupId>de.novanic.gwteventservice</groupId>
<artifactId>eventservice</artifactId>
<version>1.2.1</version>
</dependency>
将它添加到我的 pom.xml
后,更新 Maven 依赖项并清理我的项目,突然出现一大堆编译器错误。
我从 Eclipse 中的 "Problems" 选项卡复制了相关消息(每行都是一个单独的条目):
The method setCellStyleNames(String) is undefined for the type Column<T,capture#5-of ?>
The constructor SimplePager(SimplePager.TextLocation, boolean, int, boolean) is undefined
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
The method getSafeUri() is undefined for the type ImageResource GameSearchTable.java
The method getSafeUri() is undefined for the type ImageResource GameSearchTable.java
The method getSafeUri() is undefined for the type ImageResource GameSearchTable.java
The method getSafeUri() is undefined for the type ImageResource GameSearchTable.java
The method getSafeUri() is undefined for the type ImageResource GameSearchTable.java
The method setSortable(boolean) is undefined for the type GameSearchTable.RatingColumn
The method setSortable(boolean) is undefined for the type GameSearchTable.StatusColumn
The method setSortable(boolean) is undefined for the type TextColumn<GameDTO>
The method setSortable(boolean) is undefined for the type TextColumn<GameDTO>
The type GameSearchTable.RatingCell must implement the inherited abstract method AbstractCell<GameDTO>.render(GameDTO, Object, SafeHtmlBuilder)
The type GameSearchTable.StatusCell must implement the inherited abstract method AbstractCell<GameDTO>.render(GameDTO, Object, SafeHtmlBuilder)
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method setSortable(boolean) is undefined for the type GameTable.RatingColumn
The method setSortable(boolean) is undefined for the type GameTable.StatusColumn
The method setSortable(boolean) is undefined for the type TextColumn<GameDTO>
The type GameTable.RatingCell must implement the inherited abstract method AbstractCell<GameDTO>.render(GameDTO, Object, SafeHtmlBuilder)
The type GameTable.StatusCell must implement the inherited abstract method AbstractCell<GameDTO>.render(GameDTO, Object, SafeHtmlBuilder)
The constructor ActivityManager(ActivityMapper, EventBus) is undefined
The method register(com.google.gwt.place.shared.PlaceController, com.google.gwt.event.shared.EventBus, com.google.gwt.place.shared.Place) in the type PlaceHistoryHandler is not applicable for the arguments (com.google.gwt.place.shared.PlaceController, com.google.web.bindery.event.shared.EventBus, com.google.gwt.place.shared.Place)
The constructor PlaceController(EventBus) is undefined
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
com.google.gwt.cell.client.Cell.Context cannot be resolved to a type
Context cannot be resolved to a type
Context cannot be resolved to a type
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method getSafeUri() is undefined for the type ImageResource
The method setSortable(boolean) is undefined for the type PlatformTable.ProgressBarColumn
The method setSortable(boolean) is undefined for the type PlatformTable.RatingColumn
The method setSortable(boolean) is undefined for the type PlatformTable.StatusColumn
The method setSortable(boolean) is undefined for the type TextColumn<PlatformDTO>
The type PlatformTable.ProgressBarCell must implement the inherited abstract method AbstractCell<PlatformDTO>.render(PlatformDTO, Object, SafeHtmlBuilder)
The type PlatformTable.RatingCell must implement the inherited abstract method AbstractCell<PlatformDTO>.render(PlatformDTO, Object, SafeHtmlBuilder)
The type PlatformTable.StatusCell must implement the inherited abstract method AbstractCell<PlatformDTO>.render(PlatformDTO, Object, SafeHtmlBuilder)
The method setWidget(int, int, Widget) in the type HTMLTable is not applicable for the arguments (int, int, IsWidget)
The method setWidget(int, int, Widget) in the type HTMLTable is not applicable for the arguments (int, int, IsWidget)
有趣的是,这些只出现在代码的 客户端 上。如果没有添加依赖项,我的应用程序可以正常编译。
我的环境:
- Java1.7.0_55
- GWT 2.6.0
- 行家 3.3.1
到目前为止我试过什么都没有成功:
- 在我的
pom.xml
中使用较早版本 (1.2.0) 的 gwteventservice
- Eclipse 建议快速修复以将
gwt-user.jar
添加到我的构建路径 - 正在将依赖项
gwt-user
添加到我的pom.xml
- 将相关的外部 jar 直接添加到我的构建路径(这是唯一有效的方法,但我真的不喜欢这个解决方案......我宁愿把所有东西都放在我的
pom.xml
)
所以问题是:
- 为什么添加依赖项会破坏我的项目并且
- 我该如何解决这个问题?
如果没有其他帮助,我可能会考虑 gwt-comet
。
gwteventservice
依赖于 gwt 2.1.0 here。我认为您不能将它与 GWT 2.6.0 一起使用。
尝试排除从事件服务传递继承的依赖项。
<dependencies>
....
<dependency>
<groupId>de.novanic.gwteventservice</groupId>
<artifactId>eventservice</artifactId>
<version>1.2.1</version>
<exclusions>
<exclusion>
<artifactId>gwt-servlet</artifactId>
<groupId>com.google.gwt</groupId>
</exclusion>
<exclusion>
<artifactId>gwt-user</artifactId>
<groupId>com.google.gwt</groupId>
</exclusion>
</exclusion>
</dependency>
<dependency>
<artifactId>gwt-user</artifactId>
<groupId>com.google.gwt</groupId>
<version>2.6.0</version>
</dependency>
<dependency>
<artifactId>gwt-servlet</artifactId>
<groupId>com.google.gwt</groupId>
<version>2.6.0</version>
</dependency>
....
</dependencies>
但是你需要为它们提供依赖项(即使你不需要它们),而 eventservice
会寻找它们。