2

问题:我在使用gwt-maven-pluginmvn install构建的 GWT 2.5.0 项目上运行并得到错误。Rebind result 'c3gw.fwk.gui.client.ClientFactory' must be a class

这是我的 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>

这是我的 C3gwGui.gwt.xml 的片段:

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

这是引发错误的行的片段:

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

    ...
}

ClientFactory 是一个接口,ClientFactoryImpl 实现了该接口。

到目前为止我发现:当我运行调试时,代码在 Eclipse 中运行良好,但当我执行 mvn install 时它就不起作用了。我已经运行了 gwt-maven-plugin 可用的所有目标(清理、编译、源代码等),它们都可以工作,所以我现在唯一能得出的结论是在 maven-war 期间发生了一些事情-plugin 阶段或更晚。

我还从以下google 教程中获取了此代码的基础知识,他们使用了一个接口,因此它应该可以工作,假设示例项目也可以工作。

4

1 回答 1

0

消除战争:正如托马斯所说,爆炸解决了这个问题。

于 2017-11-16T14:45:01.353 回答