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

对着背影说爱祢 提交于 2020-01-15 12:07:51

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/48805469/packaging-multiple-services-into-a-war-file-for-java-8-in-gae

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!