Migrating to the Cloud SDK-based Gradle plugin

If you are using the Java App Engine SDK-based plugin
(com.google.appengine.appengine-gradle) and want to move to the new
Cloud SDK, migrate to the Cloud SDK-based
(com.google.cloud.tools.appengine-gradle) plugin.

Notable differences

The old plugin runs without any specific local environment dependencies,
besides Java, but the new plugin requires that you have the
Cloud SDK installed.

No Endpoints discovery doc generation

The new plugin does not generate Endpoints discovery docs, a
feature available in a separate plugin. Running your Endpoints
backend no longer requires generating this file in a build step as the server
now generates it at runtime. You should use the new plugin only if you need
to generate client libraries such as for iOS or Android. Learn more about the
new plugins by reviewing the Migrating to Endpoints Frameworks for
App Engine
guide.

EAR file format no longer supported

The new plugin no longer supports the
EAR file format for running and deploying multiple services at the same time.

New deployment command

The old plugin calls the appcfg command to deploy
applications, while the new plugin deploys using the new gcloud CLI.

JPA/JDO Datanucleus enhancement must be manually configured

If your project
uses the gradle-appengine-plugin’s JPA/JDO Datanucleus enhancement, you must
manually configure Datanucleus enhancement after switching to the
Cloud SDK-based plugin. See an example from Stackoverflow.

Android Studio is not supported

You can switch your Android Studio project to use the new plugin, but the
Android Studio App Engine development server and deployment support
does not work with this new plugin. To run and deploy your app, you have to
invoke Gradle directly.

Use of XML configuration files is supported, but not YAML.

Migrating to the new plugin

Remove the old gradle-appengine-plugin configuration and imports from your
build.gradle file.

Add the new plugin to the classpath of your build.gradle file's
buildscript section:

appengine {
run {
// configure the app to point to the right service directories
services = [
projectAsService(project),
projectAsService(":another-module")
]
}
}
// helper method to obtain correct directory and set up dependencies
def getExplodedAppDir(Project serverProject) {
// if not 'this' module, then do some setup.
if (serverProject != project) {
// make sure we evaluate other modules first so we get the right value
evaluationDependsOn(serverProject.path)
// make sure we build "run" depends on the other modules exploding wars
project.tasks.appengineRun.dependsOn serverProject.tasks.explodeWar
}
return serverProject.tasks.explodeWar.explodedAppDirectory
}