Sunday, May 31, 2009

Google App Engine with Maven

Google App Engine has an Eclipse plugin to help with uploading and enhancing your JDO classes. It also sets up the dependancies and exposes the GAR API. Very handy. But it doesn't play nicely with maven because the two of them assume a different project layout. Maven expects your webapp source to live under src/main/webapp/ and it builds an exploded war under target/ . Meanwhile, the Google App Engine plugin for eclipse is hardcoded to look for both source and target under the root folder war/

The google team will probably allow this configuration soon but until then you can update your maven pox.xml like this:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.0</version>
<configuration>
<directory>war</directory>
<warSourceDirectory>war</warSourceDirectory>
<webappDirectory>war</webappDirectory>
</configuration>
</plugin>

You may also need to create a appengine-web.xmlfile under war/WEB-INF/ to get the plugin to work if you are using appengine on an existing project.

No comments: