Jun 072015
 

The Google Plugin for Eclipse lets you create, test, and upload App Engine applications from within Eclipse. The Google Plugin for Eclipse also makes it easy to develop applications using Google Web Toolkit (GWT), to run
on App Engine or in any other environment. However, this plugin doesn’t use Maven. In this post we are going to explain how to manage dependencies in a GAE project using Eclipse and Maven.

Firstly, we have to add a new maven remote catalog going to Preferences > Maven > Archetypes
providing url http://repo1.maven.org/maven2/archetype-catalog.xml.

Now we can create a new maven project using google appengine archetypes as in the following image is shown

We will usually select the archetype com.google.appengine.archetypes:appengine-skeleton-archetype. Given we are working with Eclipse, we delete nbactions.xml, because this file is for Netbeans.
Creating a project in this way, you will get the following error in the pom.xml file:

Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:versions-maven-plugin:2.1:display-dependency-updates (execution: default, phase: compile)

You need to wrap the section plugins with the tag pluginManagement. The correct code is:

Be careful with line 49. By default, this line is missing.

We need to add after the tag </pluginManagement> the following code:

If we don’t add this code, we will get the following error while we run the application:

Failed to execute goal com.google.appengine:appengine-maven-plugin:1.9.20:devserver (default-cli) on project application-name: Execution default-cli of goal com.google.appengine:appengine-maven-plugin:1.9.20:devserver failed. NoSuchElementException -> [Help 1]

If you are going to develop applications with Datastore and JDO, and you want to change the default version, you will have to add, for example, the following dependencies in pom.xml:

A valid and complete pom.xml would be

The best way to build and run the project from within Eclipse is to right click on the project, select Run As, then select Maven Build

Then select DevAppServer: appengine:devserver configuration.

Finally,

If you want to deploy the project, right click again on the project, select Run As, then select Maven Build and select UpdateApplication: appengine:update configuration. Previously, you have to update the tags application and version in your appengine-web.xml file with the name and version of your GAE project.

The first time you deploy the project, you will have to authenticate using a google account in your browser. Then you will shown with a long string that you will paste next to Please enter code, as you can see in the following image:

This is the result of a successfully deployment.

Related posts

Deploying a GAE Application
App Engine Datastore

Sorry, the comment form is closed at this time.