❯ Guillaume Laforge

Serverless tip #2 — Deploy an executable JVM application with gcloud without app.yaml or build tool plugin

Requirements:

  • an existing Google Cloud Platform account and project
  • a Java or alternative language web application
  • a build that creates a standalone executable JAR file

Usually App Engine applications in Java are deployed with the gcloud command-line interface, or via a Maven or Gradle build plugin. Either way, an app.yaml file to describe your application is required to let the cloud SDK know that the project at hand is an App Engine project.

With the Java 11 runtime, however, it’s possible to deploy a standalone executable JAR without app.yaml. The gcloud app deploy command now takes also a path to a standalone JAR file:

gcloud app deploy path/to/app.jar

App Engine will automatically assume that you are deploying to the Java 11 runtime, using an F1 instance (256MB of RAM and 600MHz of CPU). So this deployment would be equivalent to having a simple app.yaml file as follows:

runtime: java11
instance_class: F1

More information: