Multivalued parameter for mvn appengine:deploy

2019-07-26 21:06发布

问题:

I'm trying to execute a Maven goal which takes a parameter with multiple values (list of values). How can I do that?

In gcloud this can be done with gcloud app deploy --quiet --project $(PROJECT) -v $(VERSION) app.yaml backend.yaml cron.yaml index.yaml queue.yaml

But we are using Maven.

We tried

mvn appengine:deploy -Dapp.deploy.deployables=app.yaml cron.yml queue.yaml

But this is not working. In fact, five commands are needed just to deploy.

mvn appengine:deploy 
mvn appengine:deployCron
mvn appengine:deployDispatch
mvn appengine:deployIndex 
mvn appengine:deployQueue 

How can this be done in one command in Maven?

回答1:

The values for -Dapp.deploy.deployables should be comma-separated. However, app.yaml needs to point to a staged location when using this flag, so you may need to stage your app beforehand with mvn appengine:stage if you want to deploy it with other configuration files.

$ mvn appengine:stage
$ mvn appengine:deploy -Dapp.deploy.deployables=src/main/appengine/queue.yaml,target/appengine-staging/app.yaml

In the output of the last command, you'll see something like

INFO: submitting command: <...>/bin/gcloud app deploy <...>/src/main/appengine/queue.yaml <...>/target/appengine-staging/app.yaml
[INFO] GCLOUD: Services to deploy:
[INFO] GCLOUD: 
[INFO] GCLOUD: descriptor:      [<...>/target/appengine-staging/app.yaml]
[INFO] GCLOUD: source:          [<...>/target/appengine-staging]
[INFO] GCLOUD: target project:  [<...>]
[INFO] GCLOUD: target service:  [default]
[INFO] GCLOUD: target version:  [20170807t115019]
[INFO] GCLOUD: target url:      [https://<...>]
[INFO] GCLOUD: 
[INFO] GCLOUD: 
[INFO] GCLOUD: Configurations to update:
[INFO] GCLOUD: 
[INFO] GCLOUD: descriptor:      [<...>/src/main/appengine/queue.yaml]
[INFO] GCLOUD: type:            [task queues]
[INFO] GCLOUD: target project:  [<...>]
[INFO] GCLOUD: 
[INFO] GCLOUD: 
[INFO] GCLOUD: If this is your first deployment, this may take a while...
[INFO] GCLOUD: ....done.
[INFO] GCLOUD: 
[INFO] GCLOUD: Beginning deployment of service [default]...
[INFO] GCLOUD: Building and pushing image for service [default]