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

五迷三道 提交于 2019-12-11 05:32:11

问题


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

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.

I'm using the gwt-maven-plugin archetype to generate a sample project as specified here.

I have successfully generated the project files and imported them as a maven project into 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.

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


回答1:


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). This caused the required classes to appear in the classpath as expected.




回答2:


It appears the appengine package is not in your classpath. I personally have never used GWT but a quick google turned up this:

<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. I am assuming that is what the archetype should have been doing. You may want to take a look at this.




回答3:


You will need to add references to the Google Maven repository so the dependencies and parent POM can be downloaded.

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


来源:https://stackoverflow.com/questions/1124890/gwt-maven-plugin-unable-to-run-archetype-generated-sample-project-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!