App Engine Gradle Plugin Tasks and Properties

After adding the App Engine plugin to your project, you can use the following App Engine-specific Gradle tasks for applications in the App Engine standard environment:

Task Description
tasks Displays help information on installed tasks.
appengineCloudSdkLogin Sets the global gcloud CLI state for account.
appengineDeploy Stages and deploys an application to App Engine.
appengineDeployAll Stages and deploys an application with all of its valid yaml configurations simultaneously to App Engine.
appengineDeployCron Stages and deploys a cron.yaml configuration file to App Engine.
appengineDeployDispatch Stages and deploys a dispatch.yaml configuration file to App Engine.
appengineDeployDos Stages and deploys a dos.yaml configuration file to App Engine.
appengineDeployIndex Stages and deploys an index.yaml configuration file to App Engine.
appengineDeployQueue Stages and deploys a queue.yaml configuration file to App Engine.
appengineRun Runs the App Engine development server. When the server is running, it continuously checks to determine whether appengine-web.xml has changed. If it has, the server reloads the application. You do not need to stop and restart your application because of changes to appengine-web.xml.
appengineStage Generates an application directory for deployment.
appengineStart Starts running the App Engine development server asynchronously and then returns to the command line. When this goal runs, the behavior is the same as the run goal except that Gradle continues processing tasks and exits after the server is up and running.
appengineStop Stops a running App Engine web development server.
explodeWar Explodes the WAR file into the build directory.

To see a list of all the tasks:

gradle tasks

For more information on how to set up and use Gradle, see Using App Engine Gradle.

Task properties

The contents of the gradle.build file are a set of rules to describe your build. It's written in a domain specific language for describing builds, based on the Groovy language.

Each task has associated properties below that you can use. You can specify these properties in the gradle.build file using a configuration closure task, and properties.

In the following example:

  • The configuration closure for the plugin is appengine.
  • The task is run.
  • The property, port, is set to 8080.
appengine {  // App Engine tasks configuration
  run {      // local (dev_appserver) configuration (standard environments only)
    port = 8080                 // default
  }

  deploy {   // deploy configuration
    stopPreviousVersion = true  // default - stop the current version
    promote = true              // default - & make this the current version
  }
}

If you only have to specify a few properties, you can set them in a single line:

  appengine.run.port = 8888

See the following sections for a list of the properties that are available for each task.

appengineStage

task(stage)

Generates an application directory for deployment. appengineStage is used by the appengineDeploy task.

You can use the following properties:

Property Description
compileEncoding The character encoding to use when compiling JSPs. Applies to applications running in the App Engine standard environment only.
deleteJsps Delete the JSP source files after compilation. Applies to applications running in the App Engine standard environment only.
disableJarJsps Disable adding the classes generated from JSPs. Applies to applications running in the App Engine standard environment only.
disableUpdateCheck Disable checking for gcloud CLI updates.
enableJarClasses Jar the WEB-INF/classes content. Applies to applications running in the App Engine standard environment only.
useMtimeFileWatcher Use mtime polling for detecting source code changes. Useful if modifying code from a remote machine using a distributed file system.
enableJarSplitting Split JAR files larger than 10 MB into smaller fragments. Applies to the App Engine standard environment only.
enableQuickstart Use Eclipse Jetty quickstart to process servlet annotations. Applies to the App Engine standard environment only.
jarSplittingExcludes Exclude files that match the list of comma separated SUFFIXES from all JAR files. Applies to applications running in the App Engine standard environment only.
sourceDirectory Required. The location of the compiled web application files, or the exploded WAR. This is used as the source for staging. Applies to the App Engine standard environment only. Default is build/exploded-${gradle-module-name}.
stagingDirectory Required. The directory to which to stage the application. Default is build/staged-app.

appengineRun

task(run)

Runs the App Engine development web server. When the server is running, it continuously checks to determine whether appengine-web.xml has changed. If it has, the server reloads the application. This means that you do not need to stop and restart your application because of changes to appengine-web.xml.

You can use the following properties, some of which correspond to the local development server command line flags:

Property Description
environment A map of environment variables to send to the local development server. Example: [key1: "value1", key2: "value2"]
jvmFlags Additional arguments to pass to the java command when launching an instance of the app. May be specified more than once. Example: -Xmx1024m -Xms256m
host Host name to which application services should bind. Default is localhost.
port Lowest port to which application services should bind. Default is 8080.
serverVersion Server version to launch, options are "1" and "2-alpha". Default is "1".
services Required. Path(s) to a directory containing a directory containing WEB-INF/web.xml. Default is build/exploded-app.
startSuccessTimeout Amount of time in seconds to wait for the Dev App Server to start in the background (when using appengineStart).

appengineDeploy

task(deploy)

Stages and deploys an application to App Engine.

Property Description
appEngineDirectory Location of .yaml configuration files (cron, index, etc) from which configuration specific deployments (appengineDeployCron, etc) will deploy from. For standard applications, your .xml configuration files are converted during staging to .yaml and placed in build/staged-app/WEB-INF/appengine-generated.
bucket The Google Cloud Storage bucket used to stage files associated with the deployment. If this argument is not specified, the application's default bucket is used.
imageUrl Deploy with a specific Docker image. Docker URL must be from one of the valid Google Container Registry hostnames.
projectId The Google Cloud Platform project ID to use for this invocation. You must specify a projectId, or you can set GCLOUD_CONFIG to use the project set in your gcloud config state.
promote Promote the deployed version to receive all traffic. Default is True.
server The App Engine server to connect to. Typically, you do not need to change this value.
stopPreviousVersion Stop the previously running version when deploying a new version that receives all traffic.
version The version of the app that will be created or replaced by this deployment. If you do not specify a version, one will be generated for you.

Global properties

Property Description
tools.cloudSdkHome Optional property to configure the location of the gcloud CLI. If this property is not specified, then the plugin automatically downloads the gcloud CLI.
tools.cloudSdkVersion Optional parameter to specify the desired gcloud CLI version.