App Engine-Standardanwendung lokal in Cloud Code for IntelliJ ausführen und Fehler beheben
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Vor der Bereitstellung Ihrer Anwendung in App Engine haben Sie die Möglichkeit, Ihre App Engine-Standardanwendung lokal auszuführen und eventuelle Fehler zu beheben. In diesem Dokument wird gezeigt, wie Sie die IDE für die lokale Ausführung und die Fehlerbehebung in IntelliJ IDEA konfigurieren.
Hinweise
Ihre Anwendung muss ein App Engine-Standardprojekt sein, das eine appengine-web.xml-Datei enthält.
Wenn Sie die IntelliJ IDEA Ultimate Edition verwenden, können Sie eine App Engine-Anwendung lokal ausführen. Gehen Sie dazu so vor:
Wählen Sie File > Open (Datei > Öffnen), um das Projekt zu öffnen, das Sie ausführen möchten.
Gehen Sie zum Verzeichnis mit Ihrem Projekt.
Wählen Sie Tools > Cloud Code > App Engine > Auf einem lokalen App Engine Standard-Entwicklungsserver ausführen aus.
Das Erstellen des Projekts dauert einen Moment.
Ausführungskonfiguration bearbeiten
Server konfigurieren
So können Sie die Ausführungskonfiguration für Ihren lokalen Server bearbeiten:
Wählen Sie Run > Edit Configurations aus.
Aktualisieren Sie im Dialogfeld Run/Debug Configurations die Konfigurationseinstellungen je nach Bedarf. Zu den gängigsten Einstellungen gehören:
Bereitzustellendes Artefakt
App Engine-Host
App Engine-Port
Umgebungsvariablen hinzufügen
Fügen Sie Ihrer Konfiguration gegebenenfalls Umgebungsvariablen hinzu.
Wählen Sie den Tab Startup/Connection (Start/Verbindung) aus.
Wählen Sie Run (Ausführen) aus.
Klicken Sie das Kästchen Pass environment variables (Umgebungsvariablen übergeben) an.
Fügen Sie die erforderlichen Variablen hinzu.
Wählen Sie Debug (Fehler beheben) aus.
Klicken Sie das Kästchen Pass environment variables (Umgebungsvariablen übergeben) an.
Fügen Sie die erforderlichen Variablen hinzu.
Klicken Sie auf OK, wenn Sie fertig sind.
Server stoppen
Wählen Sie Run > Stop 'Google App Engine Standard Local Server' (Ausführen > "Lokalen Google App Engine-Standardserver" stoppen), um den Entwicklungsanwendungsserver zu stoppen.
Fehler in einer Anwendung beheben
So können Sie mit der zuvor erstellten Ausführungskonfiguration die Anwendung im Fehlerbehebungsmodus ausführen:
Wählen Sie Run > Debug (Ausführen > Fehlerbehebung) aus.
Klicken Sie im Dialogfeld auf Google App Engine Standard Local Server (Lokaler Google App Engine-Standardserver).
Wenn das Projekt erstellt ist, können Sie Haltepunkte zur Fehlerbehebung der Anwendung festlegen.
Fehler in einer Anwendung in der Community Edition lokal beheben
IntelliJ Community Edition bietet keine integrierte Unterstützung für die Ausführung lokaler Java-Servlet-basierter Anwendungen. Für die lokale Fehlerbehebung der Anwendung mit der IntelliJ Community Edition müssen Sie Ihr Projekt für die Verwendung der Plug-ins Maven oder Gradle konfigurieren.
Maven
So konfigurieren Sie Ihr Projekt mit dem Maven-Plug-in
Erstellen Sie für Maven eine Ausführungs-/Fehlerbehebungskonfiguration.
Wählen Sie Run > Edit Configurations aus.
Klicken Sie auf + Neue Konfiguration hinzufügen.
Wählen Sie Maven aus.
Geben Sie im Feld Command line den Wert appengine:run ein.
Klicken Sie auf OK.
Erstellen Sie eine Remote-Fehlerbehebungskonfiguration.
Wählen Sie Run > Edit Configurations aus.
Klicken Sie auf + Neue Konfiguration hinzufügen.
Wählen Sie Remote aus.
Achten Sie darauf, dass die Portnummer mit dem Port übereinstimmt, den Sie in der Maven-Plug-in-Konfiguration Ihrer App Engine konfiguriert haben. Port 5005 ist die Standardeinstellung.
Klicken Sie im Abschnitt Before launch (Vor dem Start) auf das Pluszeichen (+).
Wählen Sie Run Another Configuration (Weitere Konfiguration ausführen) aus.
Wählen Sie die Ausführungskonfiguration für Ihr Maven-Projekt aus.
Klicken Sie auf OK.
So beheben Sie Fehler in Ihrer Anwendung lokal:
Wählen Sie Run > Debug (Ausführen > Fehlerbehebung) aus.
Wählen Sie Ihre Remote-Fehlerbehebungskonfiguration aus.
Jetzt können Sie Fehler in Ihrer Anwendung lokal beheben.
Gradle
So konfigurieren Sie Ihr Projekt mit dem Gradle-Plug-in
Erstellen Sie eine Ausführungs-/Fehlerbehebungskonfiguration für Gradle.
Wählen Sie Run > Edit Configurations aus.
Klicken Sie auf + Neue Konfiguration hinzufügen.
Wählen Sie Gradle aus.
Wählen Sie im Feld Gradle project das Modul aus, in dem Sie das Plug-in appengine-gradle-plugin konfiguriert haben.
Geben Sie im Feld Tasks den Wert appengineRun ein.
Klicken Sie auf OK.
Erstellen Sie eine Remote-Fehlerbehebungskonfiguration.
Wählen Sie Run > Edit Configurations aus.
Klicken Sie auf + Neue Konfiguration hinzufügen.
Wählen Sie Remote aus.
Achten Sie darauf, dass die Portnummer mit dem Port übereinstimmt, den Sie in der Gradle-Plug-in-Konfiguration Ihrer App Engine konfiguriert haben. Port 5005 ist die Standardeinstellung.
Klicken Sie im Abschnitt Before launch (Vor dem Start) auf das Pluszeichen (+).
Wählen Sie Run Another Configuration (Weitere Konfiguration ausführen) aus.
Wählen Sie die Ausführungskonfiguration für Ihr Gradle-Projekt aus.
Klicken Sie auf OK.
So beheben Sie Fehler in Ihrer Anwendung lokal:
Wählen Sie Run > Debug (Ausführen > Fehlerbehebung) aus.
Wählen Sie Ihre Remote-Fehlerbehebungskonfiguration aus.
Jetzt können Sie Fehler in Ihrer Anwendung lokal beheben.
Wenn der Link Debugger anhängen im Konsolenlog angezeigt wird, klicken Sie auf den Link.
So senden Sie Feedback oder melden ein Problem in Ihrer IntelliJ-IDE: Tools > Cloud Code > Hilfe / Info > Feedback geben oder Problem melden, um ein Problem auf GitHub zu melden.
[[["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-05 (UTC)."],[[["\u003cp\u003eCloud Code supports running and debugging App Engine standard applications locally within IntelliJ IDEA, but Java 8 is the only supported runtime.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine support in Cloud Code is being deprecated, with Java 8 support having ended in January 2024 and full deprecation scheduled for January 2026, so it's not recommended to create new App Engine projects.\u003c/p\u003e\n"],["\u003cp\u003eIntelliJ IDEA Ultimate Edition allows for direct local running and debugging through built-in configurations, while Community Edition requires using Maven or Gradle plugins.\u003c/p\u003e\n"],["\u003cp\u003eWhen debugging, you can set breakpoints and configure environment variables in the run configuration, and stopping the server is done through the Run menu.\u003c/p\u003e\n"],["\u003cp\u003eMaven or Gradle projects require the respective plugins to be added and run/debug configurations to be made for the plugin and remote debugging, for local debugging in the Community Edition of IntelliJ.\u003c/p\u003e\n"]]],[],null,["# Run and debug an App Engine Standard app locally in Cloud Code for IntelliJ\n\n| **Caution:** As of January 31, 2024, Java 8 support for App Engine has ended, and will be deprecated on January 31, 2026. As a result, Cloud Code disables App Engine by default. To enable App Engine in your IDE, navigate to **Settings** \\\u003e **Google\n| Cloud Code** \\\u003e **App Engine** . Due to the upcoming deprecation of App Engine, we don't recommend creating new App Engine projects. For more information about App Engine deprecations, see [Feature deprecations](/appengine/docs/standard/deprecations). For more information about the runtime support schedule for App Engine, see [Runtime support schedule](/appengine/docs/standard/lifecycle/support-schedule).\n\nPrior to deploying your application to\n[App Engine](/appengine/docs/standard/java), you can run and debug\nyour App Engine standard application locally. This document describes\nhow to configure the IDE for local run and debug from within IntelliJ IDEA.\n| **Note:** The following IDEs support this feature:\n|\n| - IntelliJ IDEA - Ultimate\n| - IntelliJ IDEA - Community\n| **Note:** For the App Engine standard environment, only Java applications using [Java 8 runtime](/appengine/docs/standard/java/runtime) are supported on Cloud Code.\n\nBefore you begin\n----------------\n\n- Ensure your application is an App Engine standard project that\n contains an `appengine-web.xml` file\n\n- To access the Cloud Client Libraries locally, complete the\n [Adding Cloud Client Libraries to Your Maven\n Projects](/code/docs/intellij/client-libraries) procedures.\n\n| **Note:** Run configurations for local run and debug are only available in IntelliJ Ultimate Edition. If you are using Community Edition, you can follow the [debugging your application locally on Community Edition](#community) instructions to use the Maven or Gradle plugins for your local run.\n\nRunning your application locally\n--------------------------------\n\nIf you're using IntelliJ IDEA Ultimate Edition, you can run an\nApp Engine application locally by following these instructions:\n\n1. Select **File** \\\u003e **Open** to open the project you want to run.\n\n2. Browse to the directory containing your project.\n\n3. Select **Tools** \\\u003e **Cloud Code** \\\u003e **App Engine** **Run on a local\n App Engine Standard dev server**.\n\nThe project takes a moment to build.\n\nEditing the run configuration\n-----------------------------\n\n### Configure the server\n\nYou can edit the run configuration for your local server:\n\n1. Select **Run** \\\u003e **Edit Configurations**.\n\n2. From the **Run/Debug Configurations** dialog, update configuration settings\n as needed. Some common settings include:\n\n - Artifact to deploy.\n - App Engine Host.\n - App Engine Port.\n\n### Add environment variables\n\nIf needed, add environment variables to your configuration.\n\n1. Select the **Startup/Connection** tab.\n\n2. Select **Run**.\n\n3. Select the **Pass environment variables** checkbox.\n\n4. Add the necessary variables.\n\n5. Select **Debug**.\n\n6. Select the **Pass environment variables** checkbox.\n\n7. Add the necessary variables.\n\n8. When finished, click **OK**.\n\nStopping the server\n-------------------\n\nTo stop the Dev App Server, choose **Run** \\\u003e\n**Stop 'Google App Engine Standard Local Server'**.\n\nDebugging the application\n-------------------------\n\nYou can use the run configuration you previously created to run your application\nin debug mode as follows:\n\n1. Select **Run** \\\u003e **Debug**.\n\n2. In the dialog, click **Google App Engine Standard Local Server**.\n\n3. After the project builds, you can set breakpoints to debug your app.\n\nDebugging your application locally on Community Edition\n-------------------------------------------------------\n\nIntelliJ Community Edition does not provide built-in support for running local\nJava servlet-based applications. To debug your application locally using IntelliJ\nCommunity Edition, configure your project to use the\n[Maven](/appengine/docs/standard/java/using-maven) or\n[Gradle](/appengine/docs/standard/java/using-gradle) plugin. \n\n### Maven\n\nConfiguring your project using the Maven plugin\n\n1. [Add the App Engine Maven\n plugin](/appengine/docs/standard/java/using-maven#adding_the_app_engine_maven_plugin_to_an_existing_project)\n to your project's `pom.xml` file.\n\n2. [Configure debugging on a development\n server](/appengine/docs/standard/java/using-maven#testing_your_application_with_the_development_server).\n\n3. Create Run/Debug configuration for Maven.\n\n 1. Select **Run** \\\u003e **Edit Configurations**.\n\n 2. Click **+ Add New Configuration**.\n\n 3. Select **Maven**.\n\n 4. In the **Command line** field, enter `appengine:run`.\n\n 5. Click **OK**.\n\n4. Create a remote debug configuration.\n\n 1. Select **Run** \\\u003e **Edit Configurations**.\n\n 2. Click **+ Add New Configuration**.\n\n 3. Select **Remote**.\n\n 4. Ensure that the port number is the same as the port you configured in\n your Maven App Engine plugin configuration. Port **5005** is\n the default.\n\n 5. In the **Before launch** section, click **+ Add**.\n\n 6. Select **Run Another Configuration**.\n\n 7. Select the run configuration for your Maven project.\n\n 8. Click **OK**.\n\n5. To debug your application locally:\n\n 1. Select **Run** \\\u003e **Debug**.\n\n 2. Select your remote debug configuration.\n\n You can now debug your application locally.\n\n### Gradle\n\nConfiguring your project using the Gradle plugin\n\n1. [Create a new Gradle\n project](/appengine/docs/standard/java/using-gradle#creating_a_new_project).\n\n2. [Configure debugging on a development\n server](/appengine/docs/standard/java/using-gradle#testing_gradle_app).\n\n3. Create Run/Debug configuration for Gradle.\n\n 1. Select **Run** \\\u003e **Edit Configurations**.\n\n 2. Click **+ Add New Configuration**.\n\n 3. Select **Gradle**.\n\n 4. In the **Gradle project** field, select the module where you\n configured the `appengine-gradle-plugin` plugin.\n\n 5. In the **Tasks** field, enter `appengineRun`.\n\n 6. Click **OK**.\n\n4. Create a remote debug configuration.\n\n 1. Select **Run** \\\u003e **Edit Configurations**.\n\n 2. Click **+ Add New Configuration**.\n\n 3. Select **Remote**.\n\n 4. Ensure that the port number is the same as the port you configured in\n your Gradle App Engine plugin configuration. Port **5005** is the\n default.\n\n 5. In the **Before launch** section, click **+ Add**.\n\n 6. Select **Run Another Configuration**.\n\n 7. Select the run configuration for your Gradle project.\n\n 8. Click **OK**.\n\n5. To debug your application locally:\n\n 1. Select **Run** \\\u003e **Debug**.\n\n 2. Select your remote debug configuration.\n\n You can now debug your application locally.\n 3. If the **Attach Debugger** link appears in the console log, click the\n link.\n\n | **Note:** If the port you've chosen is blocked, configure a different port number (for example, **5009**) in your Gradle App Engine plugin configuration and update the port number in the remote configuration to the same port number.\n\nWhat's next\n-----------\n\n- Next, you can deploy your app to the [App Engine standard\n environment](/code/docs/intellij/deploy-std).\n\nGet support\n-----------\n\nTo submit feedback or report an issue in your IntelliJ IDE, go to **Tools** \\\u003e **Cloud Code** \\\u003e **Help / About** \\\u003e **Submit\nfeedback or report an issue** to report an issue on [GitHub](https://github.com/GoogleCloudPlatform/cloud-code-intellij/issues)."]]