Getting Started: Setting Up Your Development Environment

Learn how to set up your build environment for app development and deployment to the Java 8 runtime in the App Engine standard environment.

This guide will show you how to:

  • Install the Google Cloud CLI.
  • Install and configure the App Engine plugin for Maven. App Engine also provides plugins for Gradle, IntelliJ IDEA, and Eclipse, but this guide demonstrates the Maven plugin.
  • 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 and initialize the latest version of the gcloud CLI.

    Install and Initialize gcloud CLI

  3. Install the App Engine Java component:

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

    gcloud auth application-default login

Configuring Maven in your development environment

  1. Download Maven 3.5 or later from the Maven website.

  2. Install Maven 3.5 or later on your local machine.

Creating a new App Engine project

To create an App Engine App:

  1. Create a new directory.

  2. Initialize 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 Google Cloud project.

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

    3. Set -DCloudSDK_Tooling=true to use gcloud CLI 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 gcloud CLI-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. The builds are created in the app's region.

What's next

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