Migrating an Existing App Engine App

Move your app into the flexible environment

Google supplies a Java runtime for the flexible environment that works with applications that were originally written for the App Engine standard environment and use the standard environment's APIs. Because this runtime is backwards-compatible it is called a "compat" runtime.

If you would like to deploy your application on the flexible environment and continue to use the standard environment APIs, select the compat runtime by adding the setting <vm>true</vm> to the application's appengine-web.xml configuration file:

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">

Most users will also wish to add the appengine-maven-plugin: to the <plugins> section of their pom.xml file:


With this configuration, your application uses an OpenJDK / Jetty 9.3 Java runtime that is compatible with a subset of the App Engine APIs:

As you become more familiar with the flexible environment you should use the native features of the Java runtime and the Google Cloud client libraries for Java rather than App Engine SDKs.

Deploying your app

  • Continue to use the same WAR directory that contains web.xml and appengine-web.xml files.
  • If you want to set environment variables, you can add them to the appengine- web.xml file. For example, to set the temporary directory:

      <env-var name="TMPDIR" value="/path/to/directory/" />
  • Test the app by running mvn appengine:run

  • Deploy the application using mvn appengine:deploy

Running in the flexible environment

You must also take into account these differences when migrating an existing app:

  • The flexible environment supports manual and automatic scaling. If your app uses basic scaling, you'll need to change that in your configuration file.
  • Apps running in the flexible environment are not assigned instance classes. Instead, you specify resources in the app.yaml file.
  • Sandbox restrictions are lifted and it is possible to include native code in your classes.

Moving to Java 8

To use Java 8, add a Dockerfile to your webapp/ directory with the following:

FROM gcr.io/google_appengine/jetty9-compat
ADD .  /app/

Additional information can be found at The Java 8 Runtime.

Send feedback about...

App Engine flexible environment for Java docs