Getting Started: Setting Up Your Development Environment

Learn how to set up your build environment for app development and deployment to Google App Engine Standard. The supported Java development and build environments are IntelliJ IDEA, Eclipse, Apache Maven, and Gradle.

This guide will show you how to:

  • Install the Google Cloud SDK command-line tool.
  • Install and configure App Engine plugins for Eclipse, IntelliJ, Gradle, and Maven.
  • Create a new App Engine project.
  • Give permission to Cloud Build to enable building and deploying your app.

Installing required SDKs

  1. If you haven't already installed Java SE 8 SDK, install the Java SE 8 Development Kit (JDK).

  2. Install the latest version of the Google Cloud SDK.

    Install Google Cloud SDK

  3. Install the App Engine Java component:

    gcloud components install app-engine-java
  4. Authorize your user account:

    gcloud auth application-default login
  5. Optionally, to create a service account run gcloud auth activate-service-account --key-file=your_key.json. For more information, see Authorizing Cloud SDK Tools.

Configuring your development environment


Before you begin:

  1. 安裝 Eclipse IDE for Java EE Developers 版本 4.7 或更新版本:

    下載 Eclipse

  2. 如果您已安裝 Eclipse 專用的 Google 外掛程式,請完成從 GPE 遷移的程序。

Install the plugin:

  1. 將安裝按鈕拖曳至正在執行的 Eclipse 工作區中:

    拖曳至正在執行的 Eclipse 工作區。

    或者從 Eclipse 內部,選取 [Help] > [Eclipse Marketplace...],並搜尋「Google Cloud Tools for Eclipse」。

  2. 系統出現提示時,重新啟動 Eclipse。


Before you begin:

  1. Sign in to your Google Account.

    If you don't already have one, sign up for a new account.

  2. In the Cloud Console, on the project selector page, select or create a Cloud project.

    Go to the project selector page

  3. Make sure that billing is enabled for your Google Cloud project. Learn how to confirm billing is enabled for your project.

  4. Ensure that the following software is installed on your local system:

Install the plugin:

  1. Open IntelliJ IDEA (or any supported JetBrains IDE).
  2. From your plugins marketplace (File > Settings > Plugins or for Mac OS X, IntelliJ IDEA > Preferences > Plugins), search for the 'Cloud Code' plugin and install it.

    You may be prompted to restart your IDE to activate the plugin.

  3. Configure the project JDK:

    1. Open File > Project Structure.
    2. Choose Project Settings > Project.
    3. If the Project SDK is missing, click New... and choose a JDK.


  1. Install Gradle v3.4.1 or newer

  2. Install git


  1. Download Maven 3.5 from the Maven website.

  2. Install Maven 3.5 on your local machine.

Creating a new App Engine project


  1. 按一下 [Google Cloud Platform] 工具列按鈕

  2. 選取 [Create New Project] > [Google App Engine Standard Java Project]。

  3. 在「Project name」中輸入專案名稱和 Java 套件 (Java 套件為選填)。

  4. 如要建立 Maven App Engine 專案,請勾選「Create as Maven Project」,然後在「Group ID」中輸入 Maven 群組 ID,並在「Artifact ID」輸入 Maven 構件 ID。

  5. 選取專案需要的程式庫 (App Engine APIGoogle Cloud Endpoints 及/或 Objectify)。

  6. 按一下 [Finish]。

精靈會透過簡單的 Servlet 產生原生 Eclipse 專案,此專案可從 IDE 執行及部署。


  1. Choose File > New > Project to display the New Project dialog.

  2. Choose Java in the left panel.

  3. In the Additional Libraries and Frameworks section, check the Google App Engine box for your environment.

    New Java project with 'Google App Engine Standard' selected within Additional Libraries and Frameworks.

  4. Select the additional libraries you want to add to the classpath of your application. The Servlet API is selected by default.

  5. Click Next.

  6. Enter a Project name.

  7. Enter a Project location if you do not want to keep the default.

  8. Update the fields in the More Settings section if you do not want to keep the defaults.

  9. Click Finish.


  1. Create a new directory.

  2. Initialize the new project in the created directory:

    gradle init --type java-library;
    mkdir -p src/main/webapp/WEB-INF;
    rm src/main/java/ src/test/java/

    Gradle will create a skeleton directory structure with two empty classes that are removed in the final rm command.

  3. Add the following to your build.gradle file to add App Engine Gradle tasks, Maven repositories, the App Engine Gradle plugin, dependencies, and task configuration:

    buildscript {      // Configuration for building
      repositories {
        jcenter()      // Bintray's repository - a fast Maven Central mirror & more
      dependencies {
        classpath ''
        classpath 'org.akhikhl.gretty:gretty:+'
    repositories {   // repositories for Jar's you access in your code
    apply plugin: 'java'
    apply plugin: 'war'
    apply plugin: 'org.akhikhl.gretty'
    apply plugin: ''
    dependencies {
      providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
      providedCompile ''
    // Add your dependencies here.
    gretty {
        servletContainer = 'jetty9'  // What App Engine Flexible uses
      appengine {
        deploy {   // deploy configuration
          stopPreviousVersion = true  // default - stop the current version
          promote = true              // default - & make this the current version
    group = 'com.example.appengine'   // Generated output GroupId
    version = '1.0-SNAPSHOT'          // Version in generated output
    sourceCompatibility = 1.8
    targetCompatibility = 1.8


To create an App Engine App:

  1. Create a new directory.

  2. Initialise the new project in the created directory:

     mvn archetype:generate -Dappengine-version=1.9.59 -Djava8=true -DCloudSDK_Tooling=true -Dapplication-id=your-app-id
    1. Set -Dappengine-version to the most recent version of the App Engine SDK for Java, and application-id to the ID of your Cloud project.

    2. Set -Djava8=true to deploy the project in the Java 8 runtime.

    3. Set -DCloudSDK_Tooling=true to use Cloud SDK tooling.

  3. When prompted to choose an archetype, choose the value 2 for the App Engine skeleton archetype. This creates an empty project that contains the required directory structure and files.

  4. When prompted for version, press ENTER to select the default most recent version.

  5. When prompted to Define value for property 'groupId', supply the desired namespace for your app; for example, com.mycompany.myapp.

  6. When prompted to Define value for property 'artifactId', supply the project name; for example, myapp.

  7. When prompted to Define value for property 'version', accept the default value.

  8. When prompted to Define value for property 'package', supply your preferred package name (or accept the default). The generated Java files will have the package name you specify here.

  9. When prompted to confirm your choices, accept the default value (Y).

  10. Wait for the project to finish generating, then change directories to the new project directory, for example myapp/.

  11. Add the Cloud SDK-based plugin to your project's pom.xml file.

  12. Specify the target Google Cloud Platform project ID and the service and version in the plugin configuration.

Give permission to Cloud Build

When you deploy your app, App Engine uses Cloud Build to build the app into a container and deploy the container to the runtime. Cloud Build does not have permission to deploy Java 8 apps by default, so you need to give Cloud Build permission to deploy apps in your project.

What's next

Now that your development environment is set up, you can get started developing and deploying Java apps to App Engine.