java - 如何将多个Java服务部署到同一个GCP项目

标签 java google-app-engine google-cloud-platform

如何部署多个 Java services到同一个 GCP 项目吗?

文档中提到了在 appengine-web.xml 中指定项目 ID[1]

The <application> element contains the application's project ID. This is the project ID you register when you create your project in the Google Cloud Platform Console.

但它被 gcloud 忽略和mvn [1] [2](强调我的):

gcloud and gcloud tooling (Intellij, Gradle, and the new maven plug-ins) ignore this element


Note that while every appengine-web.xml file must contain the <application> tag, the name you supply there is ignored. The name of the application is taken from the <application> tag in the appengine-application.xml file.

最后一句话似乎适用于 Java 8/Jetty 9 运行时。

java-gae-quickstart 项目没有 appengine-application.xml 文件。

[1] - appengine-web.xml Reference

[2] - Organizing xml Configuration Files

最佳答案

这是一个使用模块的示例项目:https://github.com/GoogleCloudPlatform/appengine-modules-sample-java

注释:

  • 有一个“ear”模块,它不包含代码,但有一个 application.xml 。该文件定义了您的项目的模块。
  • 有一个模块(“ear”除外)没有定义模块名称(在 appengine-web.xml 中)或模块名称为“default”,这一点很重要。这也是用于配置数据存储索引、cron 等的模块。
  • 为了部署所有模块,您需要转到 Ear 模块并执行 mvn appengine:update

关于java - 如何将多个Java服务部署到同一个GCP项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40126181/

相关文章:

google-app-engine - Google Channel API 向所有客户端发送消息

kubernetes - 针对失败的 GKE CronJob 的 GCP 警报策略

java - 使用 Scanner 和 System.in (Java) 对方法进行 Junit 测试

java - Gradle 在应用程序 :transformDexWithInstantRunSlicesApkForDebug 中崩溃

javascript - 是否可以直接使用 App Engine Cron 触发 Pub/Sub 事件

angular - 我无法连接到Google Cloud Platform中的 Elasticsearch

google-app-engine - 无法从 Google Compute Engine VM 实例访问某个外部主机

java - 如何将两个或多个数字分开并分别相加

java - 使用扫描仪逐行读取文件并从数据中创建对象

google-app-engine - 去数据存储查询获取单个实体?