Search code examples
gwtmavengwt-platform

Really painful to run GWTP in Maven


I've been struggling all day to run GWTP with Maven, essentially I created a GWTP gwt application using the Eclipse plugin. And added a simple welcome presenter. Tried it without maven and it works well running from eclipse.

However when I convert it to a maven project (I'm using m2eclipse plugin) everything breaks. So I added the required dependencies and the gwtp dependency:

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

However when I try to run it I get this error:

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

Any ideas why its quite hard to make GWTP with maven.


Solution

  • I think you might be missing the gwt-user dependency. Here is my maven pom.xml for an GWTP project:

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

    In case you use the newest gwtp 0.7 be aware that they switched from the depreciated classes in com.google.gwt.event.shared to com.google.web.bindery.event.shared.

    See here for more details.