Test and deploy to Google App Engine with the new Maven and Gradle plugins



                   


Here at Google, we strive to make it easy for developers to use Google Cloud Platform (GCP). Today, we're excited to announce the beta release of two new build tool plugins for Java developers: one for Apache Maven, and another for Gradle. Together, these plugins allow developers to test applications locally and then deploy them to cloud from the Command Line Interface (CLI), or through integration with an Integrated Development Environment (IDE) such as Eclipse and IntelliJ (check out our new native plugin for IntelliJ as well).

Developed in open-source, the plugins are available for both standard and flexible Google App Engine environments and are based on the Google Cloud SDK. The new Maven plugin for GAE standard is offered as an alternative to an existing plugin for App Engine standard. This allows users to choose the existing plugin if they wish to use tooling based on the App Engine Java SDK, or the new plugin if they wish to use tooling based on Google Cloud SDK (all other plugins are fully based on Google Cloud SDK).

After installing the Google Cloud SDK, you can install the plugins using the pom.xml or build.gradle file:

pom.xml
<plugins>
  <plugin>
    <groupId>com.google.cloud.tools</groupId>
    <artifactId>appengine-maven-plugin</artifactId>
    <version>0.1.1-beta</version>
 </plugin>
</plugins>


build.gradle
buildscript {
dependencies {
   classpath "com.google.cloud.tools:appengine-gradle-plugin:+" // latest version  } }
apply plugin: "com.google.cloud.tools.appengine"


And then, to deploy an application:
$ mvn appengine:deploy
$ gradle appengineDeploy

Once the application is deployed, you'll see its URL in the output of the shell.

For enterprise users who wish to take their compiled artifacts such as JARs and WARs through a separate release process, both plugins provide a staging command that copies the final compiled artifacts to a target directory without deploying them to the cloud. Those artifacts can then be passed to a Continuous Delivery/Continuous Integration (CI/CD) pipeline (see here for some of CI/CD offerings for GCP).


$ mvn appengine:stage
$ gradle appengineStage


You can check the status of your deployed applications in the Google Cloud Platform Console. Head to the Google App Engine tab and click on Instances to see your application’s underlying infrastructure in action.

For additional information on the new plugins, please see the documentation for App Engine Standard (Maven, Gradle) and App Engine Flexible (Maven, Gradle). If you have specific feature requests, please submit them at GitHub, for Maven and Gradle.

You can learn more about using Java on GCP at the Java developer portal, where you’ll find all the information you need to get up and running. And be on the lookout for additional plugins for Google Cloud Platform services in the coming months!

Happy Coding!