Deploying to the App Engine Flexible Environment

This document describes how to deploy a Spring Boot Java application to the App Engine flexible environment from within IntelliJ IDEA.

Prerequisites:

  • Follow the Quickstart to install and set up IntelliJ IDEA if you have not already. Then return here.

  • Make sure you have the latest version of Java installed on your system.

  • To deploy to the flexible environment, you can use either IntelliJ IDEA Community Edition or Ultimate Edition.

Downloading the Spring Boot app

The instructions in this document are based on a Spring Boot sample app.

To get the Spring Boot sample app repository, clone it to your local machine.

Open a new terminal on your machine and type:

git clone https://github.com/spring-guides/gs-spring-boot

To view the sample code, change to the directory that contains it:

cd gs-spring-boot/complete/

Deploying to the flexible environment

To deploy an App Engine project to the flexible environment:

  1. Choose File > Open to open the project you want to deploy.

  2. Browse to the directory containing your project (for the Spring Boot sample app, this is gs-spring-boot/complete/) and click ok. IntelliJ will take a moment to import the project.

  3. Choose Tools > Deploy to App Engine.

    The "Create Deployment Configuration" dialog appears:

  4. Click the ellipsis (...) at the right side of the Server field.

  5. Click the plus sign (+) to configure integration with App Engine. If the Cloud SDK is not automatically detected, click the ellipsis (...) to browse to the location of your Cloud SDK.

  6. Back in the "Create Deployment Configuration" dialog, specify a project in the Project field.

    The first time you do this, you will be prompted to log into the account associated with the Cloud Platform Console project you want to use.

  7. If the project is a Maven project, you can specify "Maven build" as a deployment source in the Deployment field.

    This indicates that the project will be built by Maven and that the output of this build will be deployed to GCP.

  8. Once configuration is complete, click Run to build and deploy the sample.

  9. If it's not opened by default, choose View > Tool Windows > Application Servers to open the Application Servers window, where you can monitor the progress of the deployment.

  10. Once the deployment is complete (this may take a few minutes if it's your first time deploying), you will see the URL of the deployed app in the shell output. Open that URL in a browser to see your application running.

Deploying a JAR / WAR file to the flexible environment

You can also select an arbitrary JAR or WAR file in the file system to deploy to the flexible environment.

To generate a WAR file for the Spring Boot app, run the following Maven command in the gs-spring-boot/complete/ directory of the sample:

mvn clean install

To use the WAR or JAR file to deploy your app:

  1. Choose Tools > Deploy to App Engine.

  2. In the Deployment field, specify "Filesystem JAR or WAR file" as the deployment source.

  3. Navigate to the JAR/WAR deployment archive created by Maven:

    cd gs-spring-boot/complete/target/gs-spring-boot-0.1.0.jar

  4. Once configuration is complete, click Run to deploy the sample.

  5. Once the deployment is complete (this may take a few minutes if it's your first time deploying), you will see the URL of the deployed app in the shell output. Open that URL in a browser to see your application running.

Deleting the server

If you ever want to delete the server you configured for your project, you can do so as follows:

  1. Choose File > Settings > Build, Execution, Deployment.

    On Mac OS X, this is IntelliJ IDEA > Preferences > Build, Execution, Deployment > Clouds.

  2. Select your server (Google App Engine) and click the minus sign (-) at the top of the window to remove it.

  3. Click OK.

What's next

Send feedback about...

Cloud Tools for IntelliJ