Exécuter et déboguer une application standard App Engine localement dans Cloud Code pour IntelliJ
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Avant de déployer votre application sur App Engine, vous pouvez exécuter et déboguer votre application standard App Engine localement. Ce document explique comment configurer l'IDE pour une exécution locale et un débogage à partir d'IntelliJ IDEA.
Avant de commencer
Vérifiez que votre application est un projet pour l'environnement standard App Engine contenant un fichier appengine-web.xml.
Si vous utilisez IntelliJ IDEA Ultimate Edition, vous pouvez exécuter une application App Engine en local en procédant comme suit :
Sélectionnez File > Open (Fichier > Ouvrir) pour ouvrir le projet à exécuter.
Accédez au répertoire contenant votre projet.
Sélectionnez Tools > Cloud Code > App EngineRun on a local App Engine Standard dev server (Outils > Cloud Code > App Engine > Exécuter sur un serveur de développement App Engine standard local).
La compilation du projet peut prendre un moment.
Modifier la configuration d'exécution
Configurer le serveur
Vous pouvez modifier la configuration d'exécution de votre serveur local :
Sélectionnez Run > Edit Configurations (Exécuter > Modifier les configurations).
Dans la boîte de dialogue Run/Debug Configurations (Configurations d'exécution/de débogage), mettez à jour les paramètres de configuration si nécessaire. Voici quelques paramètres courants à vérifier :
Cochez la case Pass environment variables (Passer les variables d’environnement).
Ajoutez les variables nécessaires.
Sélectionnez Debug (Déboguer).
Cochez la case Pass environment variables (Passer les variables d’environnement).
Ajoutez les variables nécessaires.
Lorsque vous avez terminé, cliquez sur OK.
Arrêter le serveur
Pour arrêter le serveur de développement d'applications, choisissez Run > Stop 'Google App Engine Standard Local Server' (Exécuter > Arrêter 'Google App Engine Standard Local Server').
Déboguer l'application
Vous pouvez utiliser la configuration d'exécution que vous avez précédemment créée pour exécuter votre application en mode débogage comme suit :
Sélectionnez Run > Debug (Exécuter > Déboguer).
Dans la boîte de dialogue, cliquez sur Google App Engine Standard Local Server (Serveur local en environnement standard Google App Engine).
Une fois le projet créé, vous pouvez définir des points d'arrêt pour déboguer votre application.
Déboguer votre application localement dans Community Edition
IntelliJ Community Edition ne propose aucune compatibilité native pour l'exécution d'applications locales basées sur des servlets Java. Pour déboguer votre application localement à l'aide d'IntelliJ Community Edition, configurez votre projet afin d'utiliser le plug-in Maven ou le plug-in Gradle.
Maven
Configurer votre projet en utilisant le plug-in Maven
Créez une configuration d'exécution/de débogage pour Maven.
Sélectionnez Run > Edit Configurations (Exécuter > Modifier les configurations).
Cliquez sur + Add New Configuration (Ajouter une configuration).
Sélectionnez Maven.
Dans le champ Command line (Ligne de commande), saisissez appengine:run.
Cliquez sur OK.
Créez une configuration de débogage à distance.
Sélectionnez Run > Edit Configurations (Exécuter > Modifier les configurations).
Cliquez sur + Add New Configuration (Ajouter une configuration).
Sélectionnez Remote (Distante).
Assurez-vous que le numéro de port est identique à celui que vous avez configuré dans la configuration du plug-in Gradle pour App Engine. Le port 5005 est le port par défaut.
Dans la section Before launch (Avant le lancement), cliquez sur le signe plus (+).
Sélectionnez Run Another Configuration (Exécuter une autre configuration).
Sélectionnez la configuration d'exécution pour votre projet Gradle.
Cliquez sur OK.
Pour déboguer votre application localement :
Sélectionnez Run > Debug (Exécuter > Déboguer).
Sélectionnez votre configuration de débogage distante.
Créez une configuration d'exécution/de débogage pour Gradle.
Sélectionnez Run > Edit Configurations (Exécuter > Modifier les configurations).
Cliquez sur + Add New Configuration (Ajouter une configuration).
Sélectionnez Gradle.
Dans le champ Gradle project (Projet Gradle), sélectionnez le module dans lequel vous avez configuré le plug-in appengine-gradle-plugin.
Dans le champ Tasks (Tâches), saisissez appengineRun.
Cliquez sur OK.
Créez une configuration de débogage à distance.
Sélectionnez Run > Edit Configurations (Exécuter > Modifier les configurations).
Cliquez sur + Add New Configuration (Ajouter une configuration).
Sélectionnez Remote (Distante).
Assurez-vous que le numéro de port est identique à celui que vous avez configuré dans la configuration du plug-in Gradle pour App Engine. Le port 5005 est le port par défaut.
Dans la section Before launch (Avant le lancement), cliquez sur le signe plus (+).
Sélectionnez Run Another Configuration (Exécuter une autre configuration).
Sélectionnez la configuration d'exécution pour votre projet Gradle.
Cliquez sur OK.
Pour déboguer votre application localement :
Sélectionnez Run > Debug (Exécuter > Déboguer).
Sélectionnez votre configuration de débogage distante.
Pour envoyer des commentaires ou signaler un problème dans votre IDE IntelliJ, accédez à Outils > Cloud Code > Aide / À propos > Envoyer des commentaires ou signaler un problème pour signaler un problème sur GitHub.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/08 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/08 (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)."]]