Johann
Johann

Reputation: 29877

Packaging multiple services into a war file for Java 8 in GAE

In Google App Engine (GAE), you can package multiple services into a single exploded WAR file (a.k.a EAR file) but only if your app is running under Java 7. This does not work for Java 8:

An App Engine application that uses services is organized as an unpacked Java Enterprise Archive (EAR) directory structure. The top-level EAR directory contains a single META-INF subdirectory, and a separate directory for each service in the app. Note that EAR is supported for the Java 7 runtime only, not for the Java 8 runtime.

I couldn't find anything in the GAE docs that indicates how you package multiple services into a single WAR file.

https://cloud.google.com/appengine/docs/standard/java/configuration-files

I realize that I can create a separate WAR file for each service but the local dev server supplied by Google for testing your app only accepts a single WAR file. I could run multiple instances of the dev server using different ports but that seems kind of messy.

Upvotes: 1

Views: 242

Answers (1)

Johann
Johann

Reputation: 29877

Google does have a solution but they documented in the most obscure location:

https://cloud.google.com/appengine/docs/standard/java/tools/migrate-gradle

It was easy to overlook this because the title of the document is:

Migrating to the Cloud SDK-based Gradle plugin

If you are building an app from scratch, you are not migrating anything and would easily skip this documentation. It should really have been documented at:

https://cloud.google.com/appengine/docs/standard/java/tools/gradle

Some additional instructions can be found at:

https://github.com/GoogleCloudPlatform/app-gradle-plugin/blob/master/USER_GUIDE.md

Upvotes: 1

Related Questions