Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Erfahren Sie, wie Sie Ihre Build-Umgebung für die Anwendungsentwicklung und -bereitstellung in der Java 8-Laufzeit in der App Engine-Standardumgebung einrichten.
Dieser Leitfaden enthält Informationen zu folgenden Themen:
App Engine-Plug-in für Maven installieren und konfigurieren.
App Engine bietet auch Plug-ins für Gradle, IntelliJ IDEA und Eclipse, aber in dieser Anleitung wird das Maven-Plug-in beschrieben.
Erstellen eines neuen App Engine-Projekts
Erteilen Sie Cloud Build die Berechtigung, das Erstellen und Bereitstellen Ihrer Anwendung zu aktivieren.
Stellen Sie -Dappengine-version auf die neueste Version des App Engine SDK für Java und application-id auf die ID Ihres Cloud-Projekts.
Legen Sie -Djava8=true fest, um das Projekt in der Java 8-Laufzeit bereitzustellen.
Legen Sie -DCloudSDK_Tooling=true fest, um die gcloud CLI zu verwenden.
Wenn Sie zur Auswahl eines Archetyps aufgefordert werden, wählen Sie für den App Engine-Skeleton-Archetyp den Wert 2 aus. Dadurch wird ein leeres Projekt erstellt, in dem die erforderliche Verzeichnisstruktur und die erforderlichen Dateien enthalten sind.
Wenn Sie zur Angabe der Version aufgefordert werden, drücken Sie die ENTER, um die neueste Standardversion auszuwählen.
Geben Sie bei der Aufforderung Define value for property 'groupId' den gewünschten Namespace für Ihre Anwendung an. Beispiel: com.mycompany.myapp.
Geben Sie bei der Aufforderung Define value for property 'artifactId' den Projektnamen an. Beispiel: myapp.
Übernehmen Sie den Standardwert (Define value for property 'version'), wenn Sie zur Bestätigung Ihrer Auswahl aufgefordert werden.
Geben Sie bei der Aufforderung Define value for property 'package' Ihren bevorzugten Paketnamen an (oder übernehmen Sie den Standardwert). Die generierten Java-Dateien übernehmen den hier angegebenen Paketnamen.
Übernehmen Sie bei der Aufforderungsbestätigung den Standardwert (Y).
Warten Sie, bis das Projekt fertig generiert ist. Wechseln Sie dann in das neue Projektverzeichnis,. Beispiel: myapp/.
Fügen Sie das gcloud CLI-basierte Plug-in in die pom.xml-Datei Ihres Projekts ein.
Geben Sie in der Plug-in-Konfiguration die ID des Google Cloud Platform-Zielprojekts sowie den Dienst und die Version an.
Berechtigung für Cloud Build erteilen
Wenn Sie Ihre Anwendung bereitstellen, erstellt App Engine mit Cloud Build die Anwendung in einem Container und stellt diesen für die Laufzeit bereit. Cloud Build verfügt nicht standardmäßig über die Berechtigung zum Bereitstellen von Java 8-Anwendungen. Daher müssen Sie Cloud Build die Berechtigung zum Bereitstellen von Anwendungen in Ihrem Projekt erteilen. Die Builds werden in der Region der Anwendung erstellt.
Nächste Schritte
Nachdem Sie die Entwicklungsumgebung eingerichtet haben, können Sie mit der Entwicklung und Bereitstellung von Java-Anwendungen in App Engine beginnen.
[[["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-04-21 (UTC)."],[[["\u003cp\u003eThis guide details how to set up a development environment for deploying Java 8 applications to the App Engine standard environment using Maven.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves installing the Java SE 8 SDK, the gcloud CLI, and the App Engine Java component, as well as configuring Maven.\u003c/p\u003e\n"],["\u003cp\u003eCreating a new App Engine project is achieved through Maven archetypes, where you'll set the application ID, choose the correct archetype, and define properties like group ID and project name.\u003c/p\u003e\n"],["\u003cp\u003eYou must also add the gcloud CLI-based plugin to the project's \u003ccode\u003epom.xml\u003c/code\u003e file and then configure it with your Google Cloud Platform project ID.\u003c/p\u003e\n"],["\u003cp\u003eCloud Build needs to be granted permission to deploy apps in order to successfully build and deploy Java 8 apps to App Engine.\u003c/p\u003e\n"]]],[],null,["# Getting Started: Setting Up Your Development Environment\n\nLearn how to set up your build environment for app development and deployment\nto the Java 8 runtime in the App Engine standard environment.\n\nThis guide will show you how to:\n\n- Install the [Google Cloud CLI](/sdk/docs/install).\n- Install and configure the App Engine plugin for Maven. App Engine also provides plugins for [Gradle](/appengine/docs/legacy/standard/java/using-gradle), [IntelliJ IDEA](/code/docs/intellij/create-standard), and [Eclipse](/eclipse/docs), but this guide demonstrates the Maven plugin.\n- Create a new App Engine project.\n- Give permission to Cloud Build to enable building and deploying your app.\n\nInstalling required SDKs\n------------------------\n\n1. If you haven't already installed Java SE 8 SDK,\n [install the Java SE 8 Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index.html).\n\n2. Install and initialize the latest version of the gcloud CLI.\n\n [Install and Initialize gcloud CLI](/sdk/docs)\n3. Install the App Engine Java component:\n\n gcloud components install app-engine-java\n\n4. Authorize your user account:\n\n gcloud auth application-default login\n\nConfiguring Maven in your development environment\n-------------------------------------------------\n\n1. [Download](http://maven.apache.org/download.cgi)\n Maven 3.5 or later from the Maven website.\n\n2. [Install](http://maven.apache.org/install.html)\n Maven 3.5 or later on your local machine.\n\n | **Note:** Linux users may need to download Maven instead of using `apt-get install` to install Maven.\n\nCreating a new App Engine project\n---------------------------------\n\nTo create an App Engine App:\n\n1. Create a new directory.\n\n2. Initialize the new project in the created directory:\n\n mvn archetype:generate -Dappengine-version=1.9.59 -Djava8=true -DCloudSDK_Tooling=true -Dapplication-id=your-app-id -Dfilter=com.google.appengine.archetypes:\n\n 1. Set `-Dappengine-version` to the most recent version of the App\n Engine SDK for Java, and `application-id` to the ID of your\n Google Cloud project.\n\n 2. Set `-Djava8=true` to deploy the project in the Java 8 runtime.\n\n 3. Set `-DCloudSDK_Tooling=true` to use gcloud CLI tooling.\n\n3. When prompted to choose an archetype, choose the value `2` for the\n App Engine skeleton archetype. This creates an empty project that contains\n the required directory structure and files.\n\n4. When prompted for version, press \u003ckbd\u003eENTER\u003c/kbd\u003e to select the default\n most recent version.\n\n5. When prompted to `Define value for property 'groupId'`, supply the desired namespace\n for your app; for example, `com.mycompany.myapp`.\n\n6. When prompted to `Define value for property 'artifactId'`, supply the project\n name; for example, `myapp`.\n\n7. When prompted to `Define value for property 'version'`, accept the default\n value.\n\n8. When prompted to `Define value for property 'package'`, supply your\n preferred package name (or accept the default). The generated Java files will\n have the package name you specify here.\n\n9. When prompted to confirm your choices, accept the default value (`Y`).\n\n10. Wait for the project to finish generating, then change directories to the\n new project directory, for example `myapp/`.\n\n11. Add the gcloud CLI-based plugin to your project's `pom.xml` file.\n\n \u003cbuild\u003e\n \u003cplugins\u003e\n [...]\n \u003cplugin\u003e\n \u003cgroupId\u003ecom.google.cloud.tools\u003c/groupId\u003e\n \u003cartifactId\u003eappengine-maven-plugin\u003c/artifactId\u003e\n \u003cversion\u003e2.4.4\u003c/version\u003e\n \u003cconfiguration\u003e\n \u003cprojectId\u003eyour-project-ID-goes-here\u003c/projectId\u003e\n \u003cversion\u003e1\u003c/version\u003e\n \u003c/configuration\u003e\n \u003c/plugin\u003e\n [...]\n \u003c/plugins\u003e\n \u003c/build\u003e\n\n12. Specify the target Google Cloud Platform project ID and the [service and\n version](/appengine/docs/legacy/standard/java/an-overview-of-app-engine#versions_and_instances)\n in the plugin configuration.\n\nGive permission to Cloud Build\n------------------------------\n\nWhen you deploy your app, App Engine uses Cloud Build to build the\napp into a container and deploy the container to the runtime. Cloud Build\ndoes not have permission to deploy Java 8 apps by default, so you need to\n[give Cloud Build permission to\ndeploy apps](/build/docs/securing-builds/set-service-account-permissions#granting_additional_access)\nin your project. The builds are created in the app's region.\n\nWhat's next\n-----------\n\nNow that your development environment is set up, you can get started\ndeveloping and deploying Java apps to App Engine.\n\n- [Serving Static Content](/appengine/docs/legacy/standard/java/building-app/static-content)\n- [Handling Form Data](/appengine/docs/legacy/standard/java/building-app/handling-form-data)\n- [Using Cloud SQL](/appengine/docs/legacy/standard/java/building-app/cloud-sql)\n- [Executing Code Asynchronously](/appengine/docs/legacy/standard/java/building-app/taskqueues)"]]