Menjalankan dan men-debug aplikasi App Engine Standard secara lokal di Cloud Code for IntelliJ
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Sebelum men-deploy aplikasi ke
App Engine, Anda dapat menjalankan dan men-debug
aplikasi standar App Engine secara lokal. Dokumen ini menjelaskan
cara mengonfigurasi IDE untuk menjalankan dan men-debug secara lokal dari dalam IntelliJ IDEA.
Sebelum memulai
Pastikan aplikasi Anda adalah project standar App Engine yang
berisi file appengine-web.xml
Jika menggunakan IntelliJ IDEA Ultimate Edition, Anda dapat menjalankan aplikasi App Engine secara lokal dengan mengikuti petunjuk berikut:
Pilih File > Open untuk membuka project yang ingin Anda jalankan.
Buka direktori yang berisi project Anda.
Pilih Alat > Cloud Code > App EngineJalankan di server dev App Engine Standard lokal.
Project memerlukan waktu beberapa saat untuk di-build.
Mengedit konfigurasi run
Mengonfigurasi server
Anda dapat mengedit konfigurasi run untuk server lokal:
Pilih Run > Edit Configurations.
Dari dialog Run/Debug Configurations, perbarui setelan konfigurasi sesuai kebutuhan. Beberapa setelan umum meliputi:
Artefak yang akan di-deploy.
Host App Engine.
Port App Engine.
Menambahkan variabel lingkungan
Jika perlu, tambahkan variabel lingkungan ke konfigurasi Anda.
Pilih tab Startup/Connection.
Pilih Run.
Centang kotak Pass environment variables.
Tambahkan variabel yang diperlukan.
Pilih Debug.
Centang kotak Pass environment variables.
Tambahkan variabel yang diperlukan.
Setelah selesai, klik Oke.
Menghentikan server
Untuk menghentikan Server Aplikasi Dev, pilih Run >
Stop 'Google App Engine Standard Local Server'.
Men-debug aplikasi
Anda dapat menggunakan konfigurasi run yang dibuat sebelumnya untuk menjalankan aplikasi
dalam mode debug sebagai berikut:
Pilih Run > Debug.
Dalam dialog, klik Google App Engine Standard Local Server.
Setelah project dibuat, Anda dapat menyetel titik henti sementara untuk men-debug aplikasi.
Men-debug aplikasi Anda secara lokal di Community Edition
IntelliJ Community Edition tidak menyediakan dukungan bawaan untuk menjalankan aplikasi berbasis servlet Java lokal. Untuk men-debug aplikasi secara lokal menggunakan IntelliJ Community Edition, konfigurasikan project Anda agar menggunakan plugin Maven atau Gradle.
Untuk mengirimkan masukan atau melaporkan masalah di IDE IntelliJ, buka
Tools > Cloud Code > Help / About > Submit
feedback or report an issue untuk melaporkan masalah di GitHub.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 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)."]]