App Engine Gradle Plugin Tasks and Properties

After the App Engine Gradle plugin is added 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.
appengineStage Generates an application directory for deployment.
appengineDeploy Stages and deploys an application 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.
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 appengineRun and appengineDeploy tasks.

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 Cloud SDK 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:

There are two version of the development web server, v1 (default) and v2-alpha.

The following properties are valid for v1.

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).

The following properties are valid for v2-alpha.

Property Description
adminHost Host name to which the admin server should bind. Default is localhost.
adminPort Port to which the admin server should bind. Default is 8000.
allowSkippedFiles Make files specified in the app.yaml skip_files or static handles readable by the application. Default is False.
apiPort Port to which the server for API calls should bind. Default is 0.
appYamls Deprecation in favor of services Required. Path to a yaml file, or a directory containing yaml files, or a directory containing WEB-INF/web.xml. Default is build/exploded-app.
authDomain Name of the authorization domain to use.
automaticRestart Restart instances automatically when files relevant to their service are changed. Default is True.
clearDatastore Clear the application's local datastore at startup. clearDatastore
customEntrypoint For custom runtimes in the flexible environment, specify an entrypoint for custom runtime services. This is required when such services are present. Include [PORT] in the string to pass the port number in as an argument. For example: gunicorn -b localhost:[PORT] mymodule:application.
datastorePath Path to a file used to store datastore contents (defaults to a file in storagePath if not set).
defaultGcsBucketName Default Google Cloud Storage bucket name.
devAppserverLogLevel The log level below which logging messages generated by the development web server will not be displayed on the console (this flag is more useful for diagnosing problems in dev_appserver rather than in application code). Options are debug, info, warning, critical, and error.
host Host name to which application services should bind. Default is localhost.
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
logLevel The log level below which logging messages generated by application code will not be displayed on the console. Options are debug, info, warning, critical, and error.
maxModuleInstances The maximum number of runtime instances that can be started for a particular service. The value can be an integer, in which case all services are limited to that number of instances or a comma-separated list of module: max_instances. For example: default:5,backend:3
port Lowest port to which application services should bind. Default is 8080.
pythonStartupArgs The arguments made available to the script specified in `devserver.pythonStartupScript`.
pythonStartupScript The script to run at the startup of new Python runtime instances (useful for tools such as debuggers.
runtime Specify the default runtimes you would like to use. Valid runtimes are java, custom, java7.
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.
skipSdkUpdateCheck Don't check for SDK updates. If false, use .appcfg_nag to decide. Default is False.
startSuccessTimeout Amount of time in seconds to wait for the Dev App Server to start in the background (when using appengineStart).
storagePath Path to the data (datastore, blobstore, etc.) associated with the application.
threadsafeOverride Override the application's threadsafe configuration. The value can be a boolean, in which case threadsafe settings in all services will be overridden or a comma-separated list of service:threadsafe_override. For example: default:False,backend:True.
useMtimeFileWatcher Use mtime polling for detecting source code changes. Useful if modifying code from a remote machine using a distributed file system.

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.
deployables The YAML files for the services or configurations you want to deploy. Default is the app.yaml file in the staging directory. If that is not found, attempts to automatically generate necessary configuration files (such as app.yaml) in the staging directory.
imageUrl Deploy with a specific Docker image. Docker URL must be from one of the valid Google Container Registry hostnames.
project The Google Cloud Platform project name to use for this invocation. Default is the current project selected when initializing gcloud. To verify, use gcloud config list project.
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 Google Cloud SDK. Typically the plugin finds this in the Cloud SDK when it is installed with gcloud components install app-engine-java.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

App Engine standard environment for Java