简体   繁体   English

将gwteventservice添加为Maven依赖项中断项目

[英]Adding gwteventservice as Maven dependency breaks project

I have a rather big GWT Application and I wanted to try out gwteventservice. 我有一个相当大的GWT应用程序,我想尝试gwteventservice。 For this, I took the dependency of version 1.2.1 from the Maven Repository Page : 为此,我从Maven存储库页面获取了1.2.1版的依赖项:

<dependency>
    <groupId>de.novanic.gwteventservice</groupId>
    <artifactId>eventservice</artifactId>
    <version>1.2.1</version>
</dependency>

After adding it to my pom.xml , updating the Maven dependencies and doing a clean-build of my project, a whole bunch of compiler errors suddenly appeared. 将其添加到我的pom.xml ,更新了Maven依赖关系并完成了项目的全新构建后,突然出现了许多编译器错误。
I copied the relevant messages from the "Problems" tab in Eclipse (each line is a seperate entry): 我从Eclipse的“问题”选项卡中复制了相关消息(每行是一个单独的条目):

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)

Interestingly enough, these only show up on the client-side of the code. 有趣的是,这些仅显示在代码的客户端 And without the added dependency my application compiles fine. 在没有添加依赖的情况下,我的应用程序可以正常编译。

My environment: 我的环境:

  • Java 1.7.0_55 Java 1.7.0_55
  • GWT 2.6.0 GWT 2.6.0
  • Maven 3.3.1 Maven的3.3.1

What I tried so far without success: 到目前为止我没有成功尝试过的东西:

  • Using an earlier version (1.2.0) of gwteventservice in my pom.xml 在我的pom.xml中使用gwteventservice的早期版本(1.2.0)
  • Eclipse suggested Quick-Fix to add gwt-user.jar to my build path Eclipse建议使用Quick-Fix将gwt-user.jar添加到我的构建路径中
  • Adding dependency gwt-user to my pom.xml 将依赖项gwt-user添加到我的pom.xml
  • Adding the relevant external jars directly to my build path (this is the only thing that worked, but i really dislike this solution... I rather have everything in my pom.xml ) 将相关的外部jar直接添加到我的构建路径中(这是唯一起作用的方法,但是我真的不喜欢此解决方案……我宁愿将所有内容都放在pom.xml

So the question is: 所以问题是:

  • Why does adding the dependency break my project and 为什么添加依赖项会破坏我的项目,并且
  • how can I fix this? 我怎样才能解决这个问题?

If nothing else helps, I might look into gwt-comet instead. 如果没有其他帮助,我可能会改用gwt-comet

gwteventservice has a dependency on gwt 2.1.0 as you can see here . 如您在此处看到的, gwteventservice依赖于gwt 2.1.0。 I don't think you can use it with GWT 2.6.0. 我认为您无法在GWT 2.6.0中使用它。

Try exclude dependency transitively inherited from event service. 尝试排除从事件服务中继承而来的依赖关系。

<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>

But you need to provide dependencies for both of them (even if you don't need them), while eventservice will look for them. 但是您需要为它们两者提供依赖关系(即使您不需要它们),而eventservice会寻找它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM