views:

1578

answers:

3

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

A: 

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.

predhme
Thanks, but as far as I understand it, you do not have to inherit from any parent project, and the dependencies generated by the archetype should be sufficient.I've looked at the link you provided. The maven plugin it refers to has been deprecated in favour of the codehouse gwt-maven-plugin I'm trying to use.
sarnelid
A: 

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&lt;/url&gt;
    </pluginRepository>
</pluginRepositories>

<repositories>
    <repository>
      <id>gwt-maven</id>
      <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/&lt;/url&gt;
    </repository>        
</repositories>
Rich Seller
Thanks for your answer. However, I already have the gwt-maven repository added in my maven config, and the required jars have been downloaded correctly (although they are apperenty not on the classpath as should be).
sarnelid
+1  A: 

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.

sarnelid
This will work within Eclipse, but you will need to have the relevant jars defined within your POM if you want to build with Maven
Rich Seller