在GAE中将多种服务打包到Java 8的war文件中 [英] Packaging multiple services into a war file for Java 8 in GAE
问题描述
在Google App Engine(GAE)中,您可以将多个服务打包到一个分解的WAR文件(也称为EAR文件)中,但前提是您的应用程序在Java 7下运行.这不适用于Java 8:
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:
使用服务的App Engine应用程序被组织为 解压缩的Java Enterprise Archive(EAR)目录结构.这 顶级EAR目录包含一个META-INF子目录,以及一个 应用中每个服务的单独目录.请注意,EAR是 仅支持Java 7运行时,不支持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.
我在GAE文档中找不到任何指示如何将多个服务打包到单个WAR文件中的东西.
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
我意识到我可以为每种服务创建一个单独的WAR文件,但是Google提供的用于测试您的应用的本地开发服务器仅接受一个WAR文件.我可以使用不同的端口运行开发服务器的多个实例,但这似乎有些混乱.
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.
推荐答案
Google确实提供了解决方案,但文档记录在最晦涩的位置:
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:
迁移到基于Cloud SDK的Gradle插件
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
这篇关于在GAE中将多种服务打包到Java 8的war文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!