2

Problem: I run mvn install on my GWT 2.5.0 project that I built with the gwt-maven-plugin and get the error Rebind result 'c3gw.fwk.gui.client.ClientFactory' must be a class.

This is a snippet of my pom.xml:

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>gwt-maven-plugin</artifactId>
    <version>2.5.0</version>
    <executions>
      <execution>
         <goals>
             <goal>compile</goal>
             <goal>test</goal>
             <goal>i18n</goal>
             <goal>resources</goal>
             <goal>generateAsync</goal>
         </goals>
      </execution>
     </executions>
     <configuration>
       <runTarget>C3gwGui.html</runTarget>
       <hostedWebapp>${webappDirectory}</hostedWebapp>
       <i18nMessagesBundle>c3gw.fwk.gui.client.Messages</i18nMessagesBundle>
     </configuration>
  </plugin>

  <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-war-plugin</artifactId>
      <version>2.1.1</version>
      <executions>
          <execution>
              <phase>compile</phase>
              <goals>
                  <goal>exploded</goal>
              </goals>
          </execution>
      </executions>
      <configuration>
          <webappDirectory>${webappDirectory}</webappDirectory>
      </configuration>
  </plugin>

This is a snippet of my C3gwGui.gwt.xml:

<replace-with class="c3gw.fwk.gui.client.ClientFactoryImpl">
    <when-type-is class="c3gw.fwk.gui.client.ClientFactory" />
</replace-with>

This is a snippet of the line where the error is thrown:

public void onModuleLoad() {
    ClientFactory clientFactory = GWT.create(ClientFactory.class);

    ...
}

ClientFactory is an interface and ClientFactoryImpl implements the interface.

What I've figured out so far: The code works perfectly fine in Eclipse when I run debug, it just doesn't work when I do mvn install. I've run all the goals available for gwt-maven-plugin (clean, compile, sources, etc...) and they all work so the only conclusion I can have at this point is that something is happening during the maven-war-plugin phase or much later.

I also took the basics of this code from the following google tutorial and they use an interface so it should work, assuming that the example project also works that is.

Saeed Zarinfam
  • 9,818
  • 7
  • 59
  • 72
Thirlan
  • 712
  • 1
  • 8
  • 26
  • 1
    Have you tried removing the `war:exploded`? It shouldn't be needed, AFAICT it was a hack for devmode that shouldn't be needed anymore (if it was at any time) – Thomas Broyer Jan 14 '13 at 20:19
  • Does the `com.mycompany.gwt.Module` module have an `inherits` statement for the `...C3gwGui` module? – Colin Alworth Jan 14 '13 at 22:11
  • Thanks Thomas, that worked. It builds now. I'll check if that has caused any other unwanted effects however. Colin, sorry about that I corrected my pom.xml in the post above. It was the wrong pom info. – Thirlan Jan 14 '13 at 22:48

1 Answers1

0

Removing war:exploded, as Thomas indicated, solved the issue.

Thirlan
  • 712
  • 1
  • 8
  • 26