简体   繁体   中英

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

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

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.

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 .

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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