简体   繁体   English

gwt maven插件-无法在eclipse中运行原型生成的示例项目

[英]gwt maven plugin - unable to run archetype generated sample project in eclipse

I'm trying to setup a new gwt project in Eclipse (3.4 Ganymede) using maven with the codehause gwt-mave-plugin (v. 1.1). 我正在尝试使用maven和codehause gwt-mave-plugin(v。1.1)在Eclipse(3.4 Ganymede)中设置新的gwt项目。

I have installed the Google Eclipse Plugin including the Google App Engine Java SDK 1.2.2, the Google Plugin for Eclipse 3.4 and the Google Web Toolkit SDK 1.7.0. 我已经安装了Google Eclipse插件,包括Google App Engine Java SDK 1.2.2,适用于Eclipse 3.4的Google插件和Google Web Toolkit SDK 1.7.0。

I'm using the gwt-maven-plugin archetype to generate a sample project as specified here . 我正在使用gwt-maven-plugin原型生成此处指定的示例项目。

I have successfully generated the project files and imported them as a maven project into eclipse. 我已经成功生成了项目文件,并将它们作为Maven项目导入了eclipse。 I have then generated a launch script using mvn: gwt:eclipse as specified here: mojo.codehaus.org/gwt-maven-plugin/user-guide/hosted.html. 然后,我使用mvn:gwt:eclipse生成了启动脚本,如下所示:mojo.codehaus.org/gwt-maven-plugin/user-guide/hosted.html。

The genereated launch script gets recognized by the Google Eclipse Plugin which tries to launch it as a gwt app when right-clicking and choosing run. 生成的启动脚本会被Google Eclipse插件识别,该插件会在右键单击并选择运行时尝试将其作为gwt应用程序启动。 However, the app fails to start with the following error: 但是,该应用程序无法启动并出现以下错误:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/appengine/tools/development/DevAppServerMain

Does anyone know what I'm missing here? 有人知道我在这里想念的吗? Any help or links to other resources of information would be greatly appreciated! 任何帮助或与其他信息资源的链接将不胜感激!

Thanks, Joakim 谢谢,Joakim

The solution was embarrassingly simple. 解决方案非常简单。 I had forgotten to mark the eclipse project as a GWT project (done by right-clicking on the project, choosing Google -> Web Toolkit Settings and checking a box). 我忘记将Eclipse项目标记为GWT项目(通过右键单击该项目,选择Google-> Web Toolkit设置并选中一个框来完成)。 This caused the required classes to appear in the classpath as expected. 这导致所需的类按预期出现在类路径中。

It appears the appengine package is not in your classpath. 看来appengine套件不在您的类路径中。 I personally have never used GWT but a quick google turned up this: 我个人从未使用过GWT,但是有一个快速的Google提出了以下建议:

<parent>
    <groupId>com.google</groupId>
    <artifactId>google</artifactId>
    <version>1</version>
</parent>

That was from googles site. 那是从谷歌的网站。 You need to inherit from their pom perhaps. 您可能需要从他们的pom继承。 I am assuming that is what the archetype should have been doing. 我假设这就是原型应该做的。 You may want to take a look at this . 您可能想看看这个

You will need to add references to the Google Maven repository so the dependencies and parent POM can be downloaded. 您将需要添加对Google Maven存储库的引用,以便可以下载依赖项和父POM。

<pluginRepositories>
    <pluginRepository>
      <id>gwt-maven</id>
      <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo</url>
    </pluginRepository>
</pluginRepositories>

<repositories>
    <repository>
      <id>gwt-maven</id>
      <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/</url>
    </repository>        
</repositories>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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