Google App Engine & Maven - Works For Me

Google has released its App Engine SDK on Maven central as a zip. But its very large and causes a "Error 503 backend read error".

So, after a lot of head-banging I resolved this by adding SDK zip package (Yes! one from website) and a few jars (optional), to maven. Skip to end for the commands. You may have to modify these for a newer version.

tl;dr Skip to End

Idea to Accident

I created a simple maven project for some usual "help a friend" work. It worked well, so I thought "Why not publish sources on GitHub?". After a few cycles, it looked ok, so I though I will push is to Google App Engine.

And,  the nightmare began. I added following plugin and dependency in pom.xml  based on official documentation.

1<dependency>
2  <groupId>com.google.appengine</groupId>
3  <artifactId>appengine-api-1.0-sdk</artifactId>
4  <version>1.8.8</version>
5</dependency>
1<plugin>
2  <groupId>com.google.appengine</groupId>
3  <artifactId>appengine-maven-plugin</artifactId>
4  <version>1.8.8</version>
5</plugin>

Just to be safe, I downloaded latest GAE SDK (1.8.8), Eclipse Plugin, etc. As per documentation, I tried to start dev server with following command:

1mvn appengine:devserver_start

After a long list of downloads, build failed. Bang! The trouble started. Got this:

 1[INFO] <<< appengine-maven-plugin:1.8.8:devserver_start (default-cli) @ java-servlet <<<
 2[INFO]
 3[INFO] --- appengine-maven-plugin:1.8.8:devserver_start (default-cli) @ java-servlet ---
 4[INFO]
 5[INFO] Google App Engine Java SDK - Starting the Development Server
 6[INFO]
 7[INFO] Retrieving Google App Engine Java SDK from Maven
 8Downloading: http://repo.maven.apache.org/maven2/com/google/appengine/appengine-java-sdk/1.8.8/appengine-java-sdk-1.8.8.zip
 9[INFO] ------------------------------------------------------------------------
10[INFO] BUILD FAILURE
11[INFO] ------------------------------------------------------------------------
12[INFO] Total time: 1:05.713s
13[INFO] Finished at: Sat Jan 04 01:05:29 SGT 2014
14[INFO] Final Memory: 17M/227M
15[INFO] ------------------------------------------------------------------------
16[ERROR] Failed to execute goal com.google.appengine:appengine-maven-plugin:1.8.8:devserver_start (default-cli) on project java-servlet: Could not resolve SDK artifact in Maven. Could not transfer artifact com.google.appengine:appengine-java-sdk:zip:1.8.8 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/com/google/appengine/appengine-java-sdk/1.8.8/appengine-java-sdk-1.8.8.zip. Return code is: 503 , ReasonPhrase:backend read error. -> [Help 1]
17[ERROR]
18[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
19[ERROR] Re-run Maven using the -X switch to enable full debug logging.
20[ERROR]
21[ERROR] For more information about the errors and possible solutions, please read the following articles:
22[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

This was unusual. So I tried again. Its maven central server not an "under-the-desk-server". But same no change. I tried to download zip manually, just to be sure that artifact is indeed there. Damn it! I got same error, just a little more fancy looking though!

type-banner
Google App Engine : Maven SDK Download Error

In directory index (here), I saw that this file was a large (150+MB). So, now what? I did deploy the application after testing on Tomcat 7. I used simple appcfg.sh command.

1mvn tomcat7:run
2...
3...
4appcfg.sh update target/java-servlet

But, this was not a "cool" way. Maven is my project management tool, and I should use it as much as possible.

Accident to Revival

After googling, reading, googling, reading and googling, I stumbled upon an old blog that added 1.2 version of SDK to maven using install:install-file goal. Eureka! Why not do this with SDK zip? Thats it. Here are the commands

Solution

Install SDK zip via following command.

1mvn install:install-file \
2  -Dfile=appengine-java-sdk-1.8.8.zip \
3  -DgroupId=com.google.appengine \
4  -DartifactId=appenging-java-sdk \
5  -Dversion=1.8.8 \
6  -Dpackaging=zip \
7  -DgeneratePom=true

And, an optional JAR install can be done via:

 1mvn install:install-file \
 2  -Dfile=appengine-java-sdk-1.8.8/lib/appengine-tools-api.jar
 3  -DgroupId=com.google \
 4  -DartifactId=appengine-tools \
 5  -Dversion=1.8.8 \
 6  -Dpackaging=jar \
 7  -DgeneratePom=true
 8
 9mvn install:install-file \
10  -Dfile=appengine-java-sdk-1.8.8/lib/shared/appengine-local-runtime-shared.jar \
11  -DgroupId=com.google \
12  -DartifactId=appengine-local-runtime-shared \
13  -Dversion=1.8.8 \
14  -Dpackaging=jar \
15  -DgeneratePom=true
16
17mvn install:install-file \
18  -Dfile=appengine-java-sdk-1.8.8/lib/user/appengine-api-1.0-sdk-1.8.8.jar \
19  -DgroupId=com.google \
20  -DartifactId=appengine-sdk-1.8.8-api \
21  -Dversion=1.8.8 \
22  -Dpackaging=jar \
23  -DgeneratePom=true
24
25mvn install:install-file \
26  -Dfile=appengine-java-sdk-1.8.8/lib/user/orm/datanucleus-appengine-1.0.10.final.jar \
27  -DgroupId=org.datanucleus \
28  -DartifactId=datanucleus-appengine \
29  -Dversion=1.0.10.final \
30  -Dpackaging=jar \
31  -DgeneratePom=true
comments powered by Disqus