How to use Google App Engine Java with Maven

Posted: January 08, 2010

We all want to use Google App Engine with Maven, but Google stopped deploying GAE/J releases to their Maven repository for some reason. This article explains how to use Maven with App Engine. It also explains how to setup a local Maven repository. These instructions assume you're using Linux.

Step 1 - Setup a Maven Repository

You need a local Maven repository. If you already have one setup, skip this step.

I have a VPS running Apache, and here's the steps I followed:

# create a new shell account to use to publish maven artifacts
useradd maven

# set a password for this account
passwd maven

cd /www/mydocroot
mkdir maven
chown maven maven

Step 2 - Register your repository with your local settings file

I'm assuming you're on Linux here.

cd $HOME
cd .m2   (you may have to mkdir ~/.m2 if it doesn't exist already)
vi settings.xml

You need to add a <server> block for your repository. My settings.xml looks like this:


We will use the value you put in id in a moment.

Step 3 - Download and unzip the App Engine zip

Change the URL to whatever version of App Engine you're downloading.

  cd /tmp

Step 4 - Create a bash script to import the relevant JARs to your repository

  cd /tmp

Paste this in and edit the 3 variables at the top as desired.


# version of app engine:

# your repository id from settings.xml:

# url for deployment.  here's what an scp one looks like
# path should be to the directory you made in step 1 above

# This should stay as is
mvn deploy:deploy-file -DartifactId=appengine-tools -Dversion=$VERSION \
  -Dpackaging=jar -Dfile=lib/appengine-tools-api.jar -Durl=$URL -DrepositoryId=$REPOSITORY

mvn deploy:deploy-file -DartifactId=appengine-local-runtime-shared \
  -Dversion=$VERSION -Dpackaging=jar -Dfile=lib/shared/appengine-local-runtime-shared.jar \
  -Durl=$URL -DrepositoryId=$REPOSITORY

mvn deploy:deploy-file -DartifactId=appengine-local-runtime \
  -Dversion=$VERSION -Dpackaging=jar -Dfile=lib/impl/appengine-local-runtime.jar \
  -Durl=$URL -DrepositoryId=$REPOSITORY

mvn deploy:deploy-file -DartifactId=appengine-api-stubs -Dversion=$VERSION \
  -Dpackaging=jar -Dfile=lib/impl/appengine-api-stubs.jar -Durl=$URL -DrepositoryId=$REPOSITORY

mvn deploy:deploy-file -DartifactId=appengine-api-labs -Dversion=$VERSION \
  -Dpackaging=jar -Dfile=lib/impl/appengine-api-labs.jar -Durl=$URL -DrepositoryId=$REPOSITORY

mvn deploy:deploy-file -DartifactId=appengine-sdk-api -Dversion=$VERSION \
  -Dpackaging=jar -Dfile=lib/impl/appengine-api.jar -Durl=$URL -DrepositoryId=$REPOSITORY

Step 5 - Run

chmod 755
cd appengine-java-sdk-1.3.0

This will run a bunch of maven commands to import 6 JARs to your local repository. Maven will report errors if something goes wrong.

Step 6 - Add dependencies to your pom.xml

I've found that there are 6 JAR files that are useful to add:







That's it!!