Dragons in the Algorithm
Adventures in Programming
by Michael Chermside

Upgrading GWT/AppEngine to v1.6+

I had a project using Google Web Toolkit (GWT) and App Engine. It was developed in Eclipse (which I don't like much, mostly because I don't know how to use it very well) because Google recommends this and provides support in the form of Eclipse plugins for working with these tools.

Well, they released a new version and I hit the "upgrade" button. After that, my project didn't work anymore. I tried for a day to resolve it and I just couldn't understand anything. Finally I "solved" it by uninstalling Eclipse and reinstalling it, then following the tutorial steps to create a brand new project and copying in my old files one-by-one. Another full day lost (I can only work a couple of hours per day on hobby projects).

Surely they wouldn't do it again, right? So I carefully saved everything and held my breath the next time Google released an upgrade. It promptly broke everything like last time. Only this time I solved it differently: I uninstalled Eclipse and did NOT reinstall it.

The big difference is that in the intervening month JetBrains had announced that a slightly-impaired version of IntelliJ IDEA would be available for free. The stripped down version doesn't have support for GWT and App Engine (which the paid version does have), but it's something I can use. At work, I use IntelliJ (properly paid for) but it's awfully expensive to pay for my own copy at home. (Can't use the same copy because that would disturb the corporate bean-counters, even though it is allowed by the license.) The stripped down version is fine if I can run from the command line.

There are instructions for running GWT via ant. And there are instructions for adding support for App Engine. But they are broken in (what I think is) exactly the same way that the Eclipse plugin is broken. Details from a forum posting led me to realize the problem was that it now needs a "javaagent" specified. A "javaagent" is some sort of a pre-processor that runs before main() -- apparently introduced with Java 1.5.

So after following Google's instructions, I now add the following: In my <hosted> target, along with the other <jvmarg> elements, I add a new one which looks like this:

<jvmarg value="-javaagent:${appengine.sdk}/lib/agent/appengine-agent.jar"/>

After that, I can build it using ant. I'll also need to use the command line for deploys, that looks like this:

"C:\Program Files\appengine-java-sdk-1.2.6\bin\appcfg" update war

And now it works again.

Posted Mon 09 November 2009 by mcherm in Programming