简体   繁体   中英

Adding gwteventservice as Maven dependency breaks project

I have a rather big GWT Application and I wanted to try out gwteventservice. For this, I took the dependency of version 1.2.1 from the Maven Repository Page :

<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.
I copied the relevant messages from the "Problems" tab in Eclipse (each line is a seperate entry):

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
  • GWT 2.6.0
  • Maven 3.3.1

What I tried so far without success:

  • Using an earlier version (1.2.0) of gwteventservice in my pom.xml
  • Eclipse suggested Quick-Fix to add gwt-user.jar to my build path
  • Adding dependency gwt-user to my 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 )

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.

gwteventservice has a dependency on gwt 2.1.0 as you can see here . I don't think you can use it with 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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