错误"未找到GWT模块"用于导入Eclipse的Maven项目

时间:2014-12-09 16:34:51

标签: java eclipse maven gwt windowbuilder

我已将一个Maven项目导入Eclipse,并尝试使用WindowBuilder编辑器打开com.google.gwt.core.client.EntryPoint的子类。 WindowBuilder编辑器给了我这个错误:

No GWT module found
GWT widgets can be used only in client package of GWT module.

我的环境:

  • Eclipse版本:Luna(来自Eclipse =>关于Eclipse)
  • WindowBuilder:1.7.0r44(来自Help =>安装详情)
  • GWT Designer:3.1.3r44(来自Help =>安装细节)

现在,我不确定环境如何受到项目POM.xml中设置的影响,因此我也将包含我的POM.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.netbase.nbsocialmetrics</groupId>
    <artifactId>SocialMetrics</artifactId>    
    <version>1.0</version>
  </parent>

  <groupId>com.netbase.nbsocialmetrics</groupId>
  <artifactId>nbsocialmetrics-frontend</artifactId>
  <packaging>war</packaging>
  <version>1.0</version>

  <name>nbsocialmetrics-frontend</name>

  <properties>
    <!-- Convenience property to set the GWT version -->
    <gwtVersion>2.7.0-rc1</gwtVersion>

    <!-- GWT needs at least java 1.6 -->
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <!-- For GWT -->
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt</artifactId>
        <version>${gwtVersion}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- Compile/runtime dependencies -->
    <dependency>
      <groupId>com.google.appengine</groupId>
      <artifactId>appengine-api-1.0-sdk</artifactId>
      <version>${appengine.target.version}</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>jstl</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>com.googlecode.objectify</groupId>
      <artifactId>objectify</artifactId>
      <version>5.1.1</version>
    </dependency>

    <!-- For GWT -->
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-servlet</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-user</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-dev</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- Test Dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <version>1.9.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.appengine</groupId>
      <artifactId>appengine-testing</artifactId>
      <version>${appengine.target.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.appengine</groupId>
      <artifactId>appengine-api-stubs</artifactId>
      <version>${appengine.target.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <version>2.5.1</version>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.3</version>
      </plugin>

      <plugin>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-maven-plugin</artifactId>
        <version>${appengine.target.version}</version>
      </plugin>

      <!-- For GWT -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>2.7.0-rc1</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>test</goal>
              <goal>generateAsync</goal>
            </goals>
          </execution>
        </executions>
        <!-- Plugin configuration. There are many available options, see 
          gwt-maven-plugin documentation at codehaus.org -->
        <configuration>
          <runTarget>MyGWTModule.html</runTarget>
          <modules>
            <module>com.netbase.GWTArchetype.MyGWTModule</module>
          </modules>
        </configuration>
      </plugin>

    </plugins>
  </build>

</project>

http://forums.instantiations.com/topic-11-1710.html处,我读到了一个解决方法:“解决方法很简单,只需将文件从src / main / resources复制到src / main / java即可,但实际上我不习惯使用标准结构项目。”我试过了,但它只是导致了一个不同的错误:

Internal Error

encountered unexpected internal error.

This could be caused by a bug or by a misconfiguration issue, conflict, partial update, etc.

java.lang.NoSuchMethodError: com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(Lcom/google/gwt/core/ext/TreeLogger;Ljava/lang/String;Z)Lcom/google/gwt/dev/cfg/ModuleDef;

Hide stack trace.
Stack trace:

java.lang.NoSuchMethodError: com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(Lcom/google/gwt/core/ext/TreeLogger;Ljava/lang/String;Z)Lcom/google/gwt/dev/cfg/ModuleDef;
    at com.google.gwt.dev.shell.designtime.HostedModeSupportImpl.loadModule(HostedModeSupportImpl.java:85)
    at com.google.gwt.dev.shell.designtime.HostedModeSupportImpl.createModuleSpaceHost(HostedModeSupportImpl.java:64)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.wb.internal.core.utils.reflect.ReflectionUtils.invokeMethod(ReflectionUtils.java:869)
    at com.google.gdt.eclipse.designer.hosted.tdt.HostedModeSupport.createModuleSpaceHost(HostedModeSupport.java:451)
    at com.google.gwt.dev.shell.designtime.ModuleSpace.<init>(ModuleSpace.java:60)
    at com.google.gdt.eclipse.designer.webkit.jsni.ModuleSpaceWebKit.<init>(ModuleSpaceWebKit.java:45)
    at com.google.gdt.eclipse.designer.webkit.BrowserShellWebKit.setUrl(BrowserShellWebKit.java:85)
    at com.google.gdt.eclipse.designer.hosted.tdt.HostedModeSupport.startup(HostedModeSupport.java:184)
    at com.google.gdt.eclipse.designer.model.widgets.support.GwtState.initialize0(GwtState.java:248)
    at com.google.gdt.eclipse.designer.model.widgets.support.GwtState.initialize(GwtState.java:206)
    at com.google.gdt.eclipse.designer.parser.ParseFactory.getClassLoader(ParseFactory.java:429)
    at org.eclipse.wb.internal.core.parser.AbstractParseFactory.initializeClassLoader(AbstractParseFactory.java:732)
    at com.google.gdt.eclipse.designer.parser.ParseFactory.getRootContext(ParseFactory.java:117)
    at org.eclipse.wb.internal.core.parser.JavaInfoParser.prepareParseContext(JavaInfoParser.java:1182)
    at org.eclipse.wb.internal.core.parser.JavaInfoParser.parse(JavaInfoParser.java:242)
    at org.eclipse.wb.internal.core.parser.JavaInfoParser.access$9(JavaInfoParser.java:238)
    at org.eclipse.wb.internal.core.parser.JavaInfoParser$1.runObject(JavaInfoParser.java:153)
    at org.eclipse.wb.internal.core.parser.JavaInfoParser$1.runObject(JavaInfoParser.java:1)
    at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.runDesignTime(ExecutionUtils.java:159)
    at org.eclipse.wb.internal.core.parser.JavaInfoParser.parse(JavaInfoParser.java:151)
    at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:534)
    at org.eclipse.wb.internal.core.editor.DesignPage.access$9(DesignPage.java:522)
    at org.eclipse.wb.internal.core.editor.DesignPage$8$1.run(DesignPage.java:449)
    at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:187)
    at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:156)
    at org.eclipse.swt.widgets.Display.syncExec(Display.java:4721)
    at org.eclipse.wb.internal.core.editor.DesignPage$8.run(DesignPage.java:446)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:466)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:374)
    at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:527)
    at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF_withProgress(DesignPage.java:465)
    at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:415)
    at org.eclipse.wb.internal.core.editor.UndoManager.refreshDesignerEditor(UndoManager.java:381)
    at org.eclipse.wb.internal.core.editor.DesignPage.refreshGEF(DesignPage.java:392)
    at org.eclipse.wb.internal.core.editor.actions.RefreshAction.run(RefreshAction.java:46)
    at org.eclipse.wb.internal.core.editor.actions.DesignPageAction.run(DesignPageAction.java:34)
    at org.eclipse.wb.internal.core.editor.errors.JavaWarningComposite.doRefresh(JavaWarningComposite.java:42)
    at org.eclipse.wb.internal.core.editor.errors.WarningComposite$1.widgetSelected(WarningComposite.java:93)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4188)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1467)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1490)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1475)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4031)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3658)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:236)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
Full context stack trace:

java.lang.NoSuchMethodError: com.google.gwt.dev.cfg.ModuleDefLoader.loadFromClassPath(Lcom/google/gwt/core/ext/TreeLogger;Ljava/lang/String;Z)Lcom/google/gwt/dev/cfg/ModuleDef;
    at com.google.gwt.dev.shell.designtime.HostedModeSupportImpl.loadModule(HostedModeSupportImpl.java:85)
    at com.google.gwt.dev.shell.designtime.HostedModeSupportImpl.createModuleSpaceHost(HostedModeSupportImpl.java:64)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.wb.internal.core.utils.reflect.ReflectionUtils.invokeMethod(ReflectionUtils.java:869)
    at com.google.gdt.eclipse.designer.hosted.tdt.HostedModeSupport.createModuleSpaceHost(HostedModeSupport.java:451)
    at com.google.gwt.dev.shell.designtime.ModuleSpace.<init>(ModuleSpace.java:60)
    at com.google.gdt.eclipse.designer.webkit.jsni.ModuleSpaceWebKit.<init>(ModuleSpaceWebKit.java:45)
    at com.google.gdt.eclipse.designer.webkit.BrowserShellWebKit.setUrl(BrowserShellWebKit.java:85)
    at com.google.gdt.eclipse.designer.hosted.tdt.HostedModeSupport.startup(HostedModeSupport.java:184)
    at com.google.gdt.eclipse.designer.model.widgets.support.GwtState.initialize0(GwtState.java:248)
    at com.google.gdt.eclipse.designer.model.widgets.support.GwtState.initialize(GwtState.java:206)
    at com.google.gdt.eclipse.designer.parser.ParseFactory.getClassLoader(ParseFactory.java:429)
    at org.eclipse.wb.internal.core.parser.AbstractParseFactory.initializeClassLoader(AbstractParseFactory.java:732)
    at com.google.gdt.eclipse.designer.parser.ParseFactory.getRootContext(ParseFactory.java:117)
    at org.eclipse.wb.internal.core.parser.JavaInfoParser.prepareParseContext(JavaInfoParser.java:1182)
    at org.eclipse.wb.internal.core.parser.JavaInfoParser.parse(JavaInfoParser.java:242)
    at org.eclipse.wb.internal.core.parser.JavaInfoParser.access$9(JavaInfoParser.java:238)
    at org.eclipse.wb.internal.core.parser.JavaInfoParser$1.runObject(JavaInfoParser.java:153)
    at org.eclipse.wb.internal.core.parser.JavaInfoParser$1.runObject(JavaInfoParser.java:1)
    at org.eclipse.wb.internal.core.utils.execution.ExecutionUtils.runDesignTime(ExecutionUtils.java:159)
    at org.eclipse.wb.internal.core.parser.JavaInfoParser.parse(JavaInfoParser.java:151)
    at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:534)
    at org.eclipse.wb.internal.core.editor.DesignPage.access$9(DesignPage.java:522)
    at org.eclipse.wb.internal.core.editor.DesignPage$8$1.run(DesignPage.java:449)
    at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:187)
    at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:156)
    at org.eclipse.swt.widgets.Display.syncExec(Display.java:4721)
    at org.eclipse.wb.internal.core.editor.DesignPage$8.run(DesignPage.java:446)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:466)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:374)
    at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:527)
    at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF_withProgress(DesignPage.java:465)
    at org.eclipse.wb.internal.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:415)
    at org.eclipse.wb.internal.core.editor.UndoManager.refreshDesignerEditor(UndoManager.java:381)
    at org.eclipse.wb.internal.core.editor.DesignPage.refreshGEF(DesignPage.java:392)
    at org.eclipse.wb.internal.core.editor.actions.RefreshAction.run(RefreshAction.java:46)
    at org.eclipse.wb.internal.core.editor.actions.DesignPageAction.run(DesignPageAction.java:34)
    at org.eclipse.wb.internal.core.editor.errors.JavaWarningComposite.doRefresh(JavaWarningComposite.java:42)
    at org.eclipse.wb.internal.core.editor.errors.WarningComposite$1.widgetSelected(WarningComposite.java:93)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:248)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4188)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1467)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1490)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1475)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4031)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3658)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:236)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)

是否有导入包含GWT的Maven项目然后使用WindowBuilder编辑器的说明?或者有人知道我做错了吗?

1 个答案:

答案 0 :(得分:1)

你的设计师版本不支持gwt-2.7.0,尝试降级你的gwt版本,我认为是2.5.x。

似乎这个commit打破了设计师,因为它改变了加载模块所需的签名方法,可能这不是唯一的破坏。

设计师的状态现在还不是很清楚,没有维护者,所以它没有收到更新,如果没有社区倡议,可能会discontinued