Uploading a Maven generated application on Google AppEngine

This note is written based on:

  • appengine-java-sdk-1.2.6
  • Apache Maven 2.2.1
  • Apache Ant 1.7.1

If you create an application destined to Google AppEngine using Maven, the use of the Google AppEngine SDK may not be optimal. This is because, in some instances, the generated artifact (a WAR file) is not what is expected from the SDK. In general, when generating a WAR file using Maven, an interim directory is created with all the files found inside the WAR archive. This interim directory is the expected input for the AppEngine SDK.

However, there are circumstances where an interim directory is not created. Using the Cargo Plug-in for Maven and generating an Uberwar is one example where the generated artifact does not naturally produce the needed interim directory. I find Cargo useful to build Google Wave Robots that include their own gadgets. Since Google Wave Robots must currently be hosted on Google AppEngine, I needed a script to load them automatically.

This note introduces an ANT script that unpacks the WAR file and upload the application on Google AppEngine. Two files are needed:

  • build.xml This is the script that uploads the application
  • build.properties This file includes user specific information

build.xml
Create a file called “build.xml” in the root directory of the Maven project. The content of the file should be as follows:

build.properties
Create a file called “build.properties” in the same directory as “build.xml”. The content of that file should look like:

The content of the file above should be adjusted to reflect the user’s specific SDK installation, appengine user name and password.

Running
After the files are configured correctly, uploading the application to AppEngine should be done with the following command, executed from the root directory of the project:

2 Replies to “Uploading a Maven generated application on Google AppEngine”

  1. I checked your code on my machine and the build.xml doesn”t seem overriding the appcfg properties…. though I create the build.properties file.

    When I run “ant update”, I’ve this error :
    [java] 25% Initiating update.
    [java] Your authentication credentials can’t be found and may have expired.
    [java] Please run appcfg directly from the command line to re-establish your credentials.

    I assume it means that appcfg takes its configuration in the cookies of java…

    Do you know why it happens?

Leave a Reply

Your email address will not be published. Required fields are marked *