After the App Engine Gradle plugin is added to your project, you can use the following App Engine-specific Gradle tasks in your Java 8 app:
tasksappengineStageappengineDeployappengineDeployCroncron.yaml configuration file to App Engine.appengineDeployDispatchdispatch.yaml configuration
file to App Engine.appengineDeployDosdos.yaml configuration file to App Engine.appengineDeployIndexindex.yaml configuration
file to App Engine.appengineDeployQueuequeue.yaml configuration file to App Engine.jettyRunTo 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
and the
app-gradle-plugin
repository on GitHub.
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 this example:
appengine.deploy.stopPreviousVersion and promote, are set to true.appengine.deploy.stopPreviousVersion = true
See the following sections for a list of the properties that are available for each task.
task(stage)
Generates an application directory for deployment. Used by the appengineDeploy
task and the jettyRun task.
You can use the following properties:
| Property | Description |
|---|---|
artifact |
Built artifact that has all of the classes, resources, and manifests.
Default is build/libs/[YOUR_SERVLET].war.
|
appEngineDirectory |
Location of the app.yaml file. Default is
src/main/appengine.
|
dockerDirectory |
Location of the Dockerfile. Default is
src/main/docker.
|
stagingDirectory |
Required. The directory to which to stage the application. Default is
build/staged-app.
|
task(deploy)
Stages and deploys an application to App Engine.
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:
appengine.run.port, is set to 8080.If you only have a to specify a few properties, you can set them in a single line:
appengine.run.port = 8888
| Property | Description |
|---|---|
appEngineDirectory |
Location of .yaml configuration files (cron, index, etc) from
which configuration specific deployments (appengineDeployCron, etc) will
deploy from. For flexible applications, this defaults to
src/main/appengine.
|
bucket |
The 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 Artifact Registry hostnames. |
project |
The Google Cloud Platform project name to use for this invocation.
Default is the current project selected when
initializing the gcloud tool. 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. |
| Property | Description |
|---|---|
tools.cloudSdkHome |
Optional property to configure the location of the Google Cloud CLI.
Typically the plugin finds this in the gcloud CLI when it is installed with
gcloud components install app-engine-java.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-06-11 UTC.