Der Inhalt der gradle.build-Datei ist ein Satz von Regeln zur Beschreibung Ihres Builds. Sie ist in einer domainspezifischen Sprache geschrieben, die auf der Sprache Groovy beruht.
Jeder Aufgabe sind Attribute zugeordnet (siehe unten), die verwendet werden können. Diese können Sie in der Datei gradle.build mit einem Konfigurationsabschluss, einer Aufgabe und Attributen angeben.
In diesem Fall gilt Folgendes:
Der Konfigurationsabschluss für das Plug-in lautet appengine.
Die Aufgabe ist deploy.
Die Attribute stopPreviousVersion und promote sind auf true gesetzt.
appengine{deploy{// deploy configurationstopPreviousVersion=true// default - stop the current versionpromote=true// default - & make this the current version}}
Wenn Sie nur einige Attribute angeben möchten, können Sie sie in einer einzelnen Zeile festlegen:
appengine.deploy.stopPreviousVersion=true
In den folgenden Abschnitten finden Sie eine Liste der Attribute, die für jede Aufgabe verfügbar sind.
appengineStage
task(stage)
Erzeugt ein Anwendungsverzeichnis für die Bereitstellung. Wird von den Aufgaben appengineDeploy und jettyRun verwendet.
Sie können folgende Attribute verwenden:
Attribut
Beschreibung
artifact
Erstelltes Artefakt mit allen Klassen, Ressourcen und Manifesten.
Standardwert ist build/libs/[YOUR_SERVLET].war.
appEngineDirectory
Speicherort der app.yaml-Datei. Der Standardwert ist src/main/appengine.
dockerDirectory
Speicherort von Dockerfile. Der Standardwert ist src/main/docker.
stagingDirectory
Erforderlich. Das Verzeichnis für das Staging der Anwendung. Standardwert ist build/staged-app.
appengineDeploy
task(deploy)
Löst Staging und Bereitstellung einer Anwendung in App Engine aus.
Jeder Aufgabe sind Attribute zugeordnet (siehe unten), die verwendet werden können. Diese können Sie in der Datei gradle.build mit einem Konfigurationsabschluss, einer Aufgabe und Attributen angeben.
Im folgenden Beispiel gilt:
Der Konfigurationsabschluss für das Plug-in lautet appengine.
Die Aufgabe ist run.
Das Attribut port ist auf 8080 gesetzt.
appengine{// App Engine tasks configurationrun{// local (dev_appserver) configuration (standard environments only)port=8080// default}deploy{// deploy configurationstopPreviousVersion=true// default - stop the current versionpromote=true// default - & make this the current version}}
Wenn Sie nur einige Attribute angeben möchten, können Sie sie in einer einzelnen Zeile festlegen:
appengine.run.port=8888
Attribut
Beschreibung
appEngineDirectory
Speicherort der .yaml-Konfigurationsdateien (cron, index usw.), über die konfigurationsspezifische Bereitstellungen (appengineDeployCron usw.) durchgeführt werden. Bei flexiblen Anwendungen lautet der Standardwert src/main/appengine.
bucket
Der Cloud Storage-Bucket, der für das Staging von Dateien verwendet wird, die der Bereitstellung zugeordnet sind. Wenn dieses Argument nicht angegeben ist, wird der Standard-Bucket der Anwendung verwendet.
deployables
Die YAML-Dateien für die Dienste oder Konfigurationen, die Sie bereitstellen möchten.
Der Standardwert ist die app.yaml-Datei im Staging-Verzeichnis. Wenn sie nicht gefunden wird, wird versucht, erforderliche Konfigurationsdateien wie app.yaml automatisch im Staging-Verzeichnis zu erzeugen.
imageUrl
Bereitstellen mit einem bestimmten Docker-Image. Die Docker-URL muss aus einem der
gültigen Artifact Registry-Hostnamen sein.
project
Der Google Cloud Platform-Projektname für diesen Aufruf.
Die Standardeinstellung ist das aktuelle Projekt, das beim Initialisieren von gcloud ausgewählt wurde. Verwenden Sie zur Bestätigung gcloud config list project.
promote
Bereitgestellte Version für den gesamten Traffic hochstufen. Der Standardwert ist „True“.
server
Der App Engine-Server, mit dem eine Verbindung hergestellt werden soll. Dieser Wert muss in der Regel nicht geändert werden.
stopPreviousVersion
Beendet die zuvor ausgeführte Version, wenn eine neue Version bereitgestellt wird, die den gesamten Traffic empfängt.
version
Die Version der Anwendung, die durch diese Bereitstellung erstellt oder ersetzt wird. Wenn Sie keine Version angeben, wird automatisch eine erzeugt.
Globale Attribute
Attribut
Beschreibung
tools.cloudSdkHome
Optionales Attribut zum Konfigurieren des Speicherorts der Google Cloud CLI.
In der Regel findet das Plug-in dieses in der gcloud CLI, wenn es mit gcloud components install app-engine-java installiert wird.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eThe App Engine Gradle plugin provides various tasks for managing and deploying applications, including \u003ccode\u003eappengineStage\u003c/code\u003e, \u003ccode\u003eappengineDeploy\u003c/code\u003e, and others for deploying specific configuration files like \u003ccode\u003ecron.yaml\u003c/code\u003e, \u003ccode\u003edispatch.yaml\u003c/code\u003e, etc.\u003c/p\u003e\n"],["\u003cp\u003eEach task within the App Engine Gradle plugin has configurable properties, which can be set in the \u003ccode\u003egradle.build\u003c/code\u003e file using a configuration closure (e.g., \u003ccode\u003eappengine\u003c/code\u003e) or directly in a single line, like setting \u003ccode\u003eappengine.deploy.stopPreviousVersion = true\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eappengineStage\u003c/code\u003e task generates an application directory for deployment, with configurable properties such as \u003ccode\u003eartifact\u003c/code\u003e, \u003ccode\u003eappEngineDirectory\u003c/code\u003e, \u003ccode\u003edockerDirectory\u003c/code\u003e, and \u003ccode\u003estagingDirectory\u003c/code\u003e, with \u003ccode\u003ebuild/staged-app\u003c/code\u003e being the default for \u003ccode\u003estagingDirectory\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eappengineDeploy\u003c/code\u003e task stages and deploys applications to App Engine, and allows customization of the deployment through various properties, such as \u003ccode\u003epromote\u003c/code\u003e, \u003ccode\u003estopPreviousVersion\u003c/code\u003e, and \u003ccode\u003ebucket\u003c/code\u003e, which dictate the behavior of the deployment.\u003c/p\u003e\n"],["\u003cp\u003eYou can use \u003ccode\u003egradle tasks\u003c/code\u003e to see a complete list of all available tasks within the plugin.\u003c/p\u003e\n"]]],[],null,["# App Engine Gradle Plugin Tasks and Properties\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\nAfter the App Engine Gradle plugin is [added to your project](/appengine/docs/standard/java-gen2/using-gradle#creating_a_new_project),\nyou can use the following App Engine-specific Gradle tasks:\n\nTo see a list of all the tasks: \n\n gradle tasks\n\nFor more information on how to set up and use Gradle, see\n\n[Using\nApp Engine Gradle](/appengine/docs/standard/java-gen2/using-gradle)\nand the\n[`app-gradle-plugin`](https://github.com/GoogleCloudPlatform/app-gradle-plugin)\nrepository on GitHub.\n\nTask properties\n---------------\n\nThe contents of the `gradle.build` file are a set of rules to describe your\nbuild. It's written in a domain specific language for describing builds, based\non the\n[Groovy language](http://www.groovy-lang.org/).\n\nEach task has associated properties below that you can use. You can specify\nthese properties in the `gradle.build` file using a\n[configuration closure](https://docs.gradle.org/current/userguide/custom_plugins.html#sec:getting_input_from_the_build),\ntask, and properties.\n\nIn this example:\n\n- The configuration closure for the plugin is `appengine`.\n- The task is `deploy`.\n- The properties, `stopPreviousVersion` and `promote`, are set to `true`.\n\n appengine {\n deploy { // deploy configuration\n stopPreviousVersion = true // default - stop the current version\n promote = true // default - & make this the current version\n }\n }\n\nIf you only have a to specify a few properties, you can set them in a single line:\n\n\u003cbr /\u003e\n\n```java\n appengine.deploy.stopPreviousVersion = true\n```\n\nSee the following sections for a list of the properties that are available for\neach task.\n\nappengineStage\n--------------\n\n**task(stage)**\n\nGenerates an application directory for deployment. Used by the `appengineDeploy`\ntask and the `jettyRun` task.\n\nYou can use the following properties:\n\nappengineDeploy\n---------------\n\n**task(deploy)**\n\nStages and deploys an application to App Engine.\n\nEach task has associated properties below that you can use. You can specify\nthese properties in the `gradle.build` file using a\n[configuration closure](https://docs.gradle.org/current/userguide/custom_plugins.html#sec:getting_input_from_the_build),\ntask, and properties.\n\nIn the following example:\n\n- The configuration closure for the plugin is `appengine`.\n- The task is `run`.\n- The property, `port`, is set to `8080`.\n\n appengine { // App Engine tasks configuration\n run { // local (dev_appserver) configuration (standard environments only)\n port = 8080 // default\n }\n\n deploy { // deploy configuration\n stopPreviousVersion = true // default - stop the current version\n promote = true // default - & make this the current version\n }\n }\n\nIf you only have a to specify a few properties, you can set them in a single\nline: \n\n```java\n appengine.run.port = 8888\n```\n\nGlobal properties\n-----------------"]]