Setting up IntelliJ IDEA Ultimate Edition for Java Development and Debugging of App Engine Standard Environment Apps

Get started with local development and debugging with IntelliJ IDEA Ultimate Edition and Cloud Tools for IntelliJ. This configuration allows you to run your App Engine app locally in a debug mode and use the development environment's debugger to set breakpoints and step through your code. The Cloud Tools for IntelliJ plugins provide helper functionality for working with App Engine, including deploying apps.

Note that IntelliJ IDEA Ultimate Edition is required to build and run Servlet applications like those for Google App Engine.

Before you begin

  1. Select or create a new Cloud Platform project in the Google Cloud Platform Console and then ensure an App Engine application exists:

    Go to App Engine

    The Dashboard opens if an App Engine application already exists in your project. Otherwise, you are prompted to choose the region where you want your App Engine application located.

  2. Install and initialize the Google Cloud SDK.

    If you already have the gcloud tool installed and want to configure it to use a Cloud Platform project ID other than the one that you initialized it to, see Managing Cloud SDK Configurations.

  3. Install the IntelliJ IDEA prerequisites, which includes Java 8 for the 2016 version or Java 7 for the 2015 version.

  4. Install IntelliJ IDEA Ultimate Edition (instructions).
  5. Download and extract the App Engine SDK for Java.

Install Cloud Tools for IntelliJ IDEA

To install the plugins:

  1. From inside IDEA, open File > Settings. Or, on Mac OS X, open IntelliJ IDEA > Preferences.
  2. In the navigation pane, select Plugins.
  3. Click Browse repositories.
  4. In the dialog that opens, select Google Cloud Tools.
  5. Click Install.
  6. Click Close.
  7. Click OK in the Settings dialog.
  8. Click Restart.
  9. Configure the Cloud SDK location:
    1. Open File > Settings or on Mac OS X open IntelliJ IDEA > Preferences.
    2. Choose Build, Execution, Deployment > Clouds and select App Engine (BETA).
    3. Browse to the location where you installed the Cloud SDK. If you aren't sure where you installed it, you can run gcloud info to display its location if you used the interactive installer or added it to your environment's PATH variable.

Create an App Engine project in IntelliJ IDEA

  1. Open IntelliJ IDEA and choose Create New Project.

    Screenshot of the Welcome to IntelliJ IDEA dialog, which offers
     the ability to create a project or select an existing project.

  2. Select your project's Java SDK or click New to set up a new Java SDK. The Java SDK should be set to Java 7.

  3. From the Additional Libraries and Frameworks list, select the Google App Engine library

  4. In the Google App Engine SDK field, specify the location where you extracted the App Engine SDK.

    Screenshot which shows the values for the SDK fields filled in.

  5. Click Next.

  6. Provide a name for your project. Click Finish.

You now have a basic project including the App Engine configuration files.

Launch your app in debug mode

Running your app in debug mode in IntelliJ IDEA allows you to set breakpoints in your code. When those lines are executed, processing pauses temporarily, allowing you to inspect your code and step through the execution. This functionality is extremely helpful during development of your app.

To run your app in debug mode:

  1. Select Run > Debug AppEngine Dev.
  2. Browse to http://localhost:8080 if IntelliJ does not automatically launch the page for you.

Set a breakpoint and step through your code

Now that you have the debugger running, you can set breakpoints and use them to step through your code execution.

  1. Place your cursor in a line in your code that you want to be able to start your code inspection.
  2. Select Run > Toggle Breakpoint or press CTRL+F8. You will see a red circle icon next to the line to indicate a breakpoint is set.

    Screenshot showing a breakpoint set next to a line of code.

  3. Browse your application such that the code with the breakpoint will be executed. In the Debug window, you can inspect the variables that are set at this point in your code execution.

    Screenshot of IntelliJ IDEA showing the debug window with the
     code processing halted on a line and the variable context at that point
     in the code execution.

  4. From the Run menu or the Debug window toolbar, you can control the execution of the code to allow you to step through the code. You can choose the Resume Program (Resume program
   icon) option to continue code execution until a different breakpoint is encountered or your code finishes processing.

Deploy your app from IntelliJ IDEA

To deploy your app to the App Engine standard environment:

  1. Choose Tools > Deploy to App Engine.

  2. Configure the server:

    1. Click the ellipsis (...) next to the Server field.

      Screenshot showing the fields on the Create Deployment
     Configuration dialog.

    2. In the Cloud SDK directory field, enter the path to where you installed the Cloud SDK or click the ellipsis to browse to the location.

    3. Click OK.

  3. Specify a project in the Project field.

    The first time you configure the tool you will be prompted to sign in to the account associated with the Cloud Platform Console project that you want to deploy.

    Screenshot showing the project selection field now visible that
     previously was hidden until the Server field was populated.

  4. Click Run to build and deploy your app.

  5. In the Application Servers window, click the name of your project to monitor its deployment progress. If the window is not displaying, click View > Tool Windows > Application Servers.

  6. View your deployed application. The URL of the deployed app prints to the console output or you can view it at:


Next steps

Now that you have a development environment set up, the following topics can help you get started with App Engine:

Send feedback about...

App Engine standard environment for Java