(gcloud.preview.app.deploy) 错误响应:[400] "env" 设置不支持此部署

(gcloud.preview.app.deploy) Error Response: [400] "env" setting is not supported for this deployment

我尝试了这些教程 https://cloud.google.com/tools/cloud-repositories/docs/push-to-deploy,并且我执行了

mvn gcloud:deploy

,但收到以下错误消息:

    [dev-jenkins-test-1] $ /bin/sh -xe /tmp/hudson4310631253025446569.sh
    + mvn gcloud:deploy
    [INFO] Scanning for projects...
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building jenkins-test-java 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] >>> gcloud-maven-plugin:2.0.9.88.v20151125:deploy (default-cli) > package @ jenkins-test-java >>>
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jenkins-test-java ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory /var/jenkins/workspace/dev-jenkins-test-1/src/main/resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ jenkins-test-java ---
    [INFO] No sources to compile
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ jenkins-test-java ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory /var/jenkins/workspace/dev-jenkins-test-1/src/test/resources
    [INFO] 
    [INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ jenkins-test-java ---
    [INFO] No sources to compile
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ jenkins-test-java ---
    [INFO] No tests to run.
    [INFO] 
    [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ jenkins-test-java ---
    [WARNING] JAR will be empty - no content was marked for inclusion!
    [INFO] 
    [INFO] <<< gcloud-maven-plugin:2.0.9.88.v20151125:deploy (default-cli) < package @ jenkins-test-java <<<
    [INFO] 
    [INFO] --- gcloud-maven-plugin:2.0.9.88.v20151125:deploy (default-cli) @ jenkins-test-java ---
    [INFO] Running gcloud app deploy...
    [INFO] Running python -S /google/google-cloud-sdk/lib/googlecloudsdk/gcloud/gcloud.py --quiet --project=straw-hat-pirates-dev preview app deploy /var/jenkins/workspace/dev-jenkins-test-1/target/appengine-staging/app.yaml
    [INFO] WARNING: Soon, deployments will set the deployed version to receive all traffic by
    [INFO] default.
    [INFO] 
    [INFO] To keep the current behavior (where new deployments do not receive any traffic),
    [INFO] use the `--no-promote` flag or run the following command:
    [INFO] 
    [INFO]   $ gcloud config set app/promote_by_default false
    [INFO] 
    [INFO] To adopt the new behavior early, use the `--promote` flag or run the following
    [INFO] command:
    [INFO] 
    [INFO]   $ gcloud config set app/promote_by_default true
    [INFO] 
    [INFO] Either passing one of the new flags or setting one of these properties will
    [INFO] silence this message.
    [INFO] 
    [INFO] You are about to deploy the following modules:
    [INFO]  - straw-hat-pirates-dev/default (from [/var/jenkins/workspace/dev-jenkins-test-1/target/appengine-staging/app.yaml])
    [INFO]      Deployed URL: [https://20151223t054356-dot-straw-hat-pirates-dev.appspot.com]
    [INFO]      (add --promote if you also want to make this module available from
    [INFO]      [https://straw-hat-pirates-dev.appspot.com])
    [INFO] 
    [INFO] Beginning deployment...
    [INFO] Verifying that Managed VMs are enabled and ready.
    [INFO] 
    [INFO] Provisioning remote build service.
    [INFO] Copying certificates for secure access. You may be prompted to create an SSH keypair.
    [INFO] Building and pushing image for module [default]
    [INFO] ----------------------------- DOCKER BUILD OUTPUT ------------------------------
    [INFO] Step 0 : FROM gcr.io/google_appengine/openjdk8
    [INFO] ---> 3c058a018ce1
    [INFO] Step 1 : ADD jenkins-test-java-1.0-SNAPSHOT.jar /app/
    [INFO] ---> 938437aaa1a1
    [INFO] Removing intermediate container 4106bc3645ca
    [INFO] Step 2 : ENTRYPOINT java -jar /app/jenkins-test-java-1.0-SNAPSHOT.jar
    [INFO] ---> Running in f187a76322dd
    [INFO] ---> 4600e0f4d83a
    [INFO] Removing intermediate container f187a76322dd
    [INFO] Successfully built 4600e0f4d83a
    [INFO] --------------------------------------------------------------------------------
    [INFO] 
    [INFO] Updating module [default]...
    [INFO] Updating module [default].../
    [INFO] Updating module [default]...failed.
    [INFO] ERROR: (gcloud.preview.app.deploy) Error Response: [400] "env" setting is not supported for this deployment.
    [INFO] Deleted [https://www.googleapis.com/compute/v1/projects/straw-hat-pirates-dev/zones/us-central1-f/instances/gae-builder-vm-20151223t054356].
    [ERROR] Error: gcloud app command with exit code : 1
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 02:03 min
    [INFO] Finished at: 2015-12-23T05:45:57+00:00
    [INFO] Final Memory: 11M/56M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal com.google.appengine:gcloud-maven-plugin:2.0.9.88.v20151125:deploy (default-cli) on project jenkins-test-java: Error: gcloud app command exit code is: 1 -> [Help 1]
    [ERROR] 
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] 
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
    Build step 'Execute shell' marked build as failure
    Finished: FAILURE

我猜:
我的环境配置似乎有问题。
我仍然无法解决这个问题。
感谢您的帮助。 :)

我想通了。

我敢打赌你的 Maven 模块没有设置 <packaging>war</packaging>

如果您的模块设置为 jar(默认),那么它会尝试部署为标准 java 应用程序,您将在其中启动自己的服务器。由于您想要一个带有 appengine 运行 的托管虚拟机,您需要打包为 war,然后插件将处理其余部分。

干杯。