Amani Kilumanga
Amani Kilumanga

Reputation: 324

How to deploy multiple Java services to the same GCP project

How do I deploy multiple Java services to the same GCP project?

There are a few mentions in the documentation of specifying the project ID in the appengine-web.xml[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.

but it is ignored by gcloud and mvn[1] [2] (Emphasis mine):

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.

The last quote seems to apply to Java 8 / Jetty 9 runtimes.

The java-gae-quickstart project does not have an appengine-application.xml file.

[1] - appengine-web.xml Reference

[2] - Organizing xml Configuration Files

Upvotes: 2

Views: 1670

Answers (1)

TomTasche
TomTasche

Reputation: 5526

Here's a sample project for using modules: https://github.com/GoogleCloudPlatform/appengine-modules-sample-java

Notes:

  • there is one "ear"-module, which does not contain code, but has an application.xml. This file defines the modules of your project.
  • it's important to have one module (other than "ear") which has no module-name defined (in appengine-web.xml) or has a module-name of "default". This is also the module which is used for configuring datastore-indexes, cron, etc.
  • in order to deploy all your modules, you go to your ear-module and execute mvn appengine:update

Upvotes: 3

Related Questions