本文介绍了使用Cloud Build将Java App部署到GAE Standard的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用CloudBuilder将Java应用程序部署到GAE Standard。

I'm trying to deploy a Java application to GAE Standard using CloudBuilder.

我的cloudbuild.yaml如下:

My cloudbuild.yaml is as follows :

步骤:
-名称: gcr.io/cloud-builders/gcloud
args:[ app, deploy]
超时: 1600s

我有一个app.yaml(我不确定我是否需要),但是部署似乎总是找不到 appengine-web.xml

I have an app.yaml ( which I'm not sure I need ), but the deployment always seems to be unable to find appengine-web.xml

我有一个相当标准的Maven文件结构,而 appengine-web.xml 位于 src / main / webapp / WEB-INF / appengine-web.xml

I have a fairly standard Maven file structure, and appengine-web.xml is at src/main/webapp/WEB-INF/appengine-web.xml

我遇到了很多错误,大部分与appengine-web.xml有关,最近一次是

I've had a whole load of errors, mostly to do with appengine-web.xml, the most recent being

错误:(gcloud.app.deploy)INVALID_ARGUMENT:此运行时需要WEB-INF / appengine-web.xml。

有人能使用这种构建吗?

Has anyone got this sort of build to work?

顺便说一句,使用我的开发机器上的maven进行部署

By the way, deploying using maven from my development machine works

mvn -D skipTests清洁程序包appengine:deploy

编辑更多信息。

我正在使用Java 8

I'm using Java 8

目标运行时也是Java 8

Target runtime is also Java 8

appengine -web.xml如下

appengine-web.xml is as follows

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <application>myapp-staging</application>
    <version>alpha-001</version>
    <threadsafe>true</threadsafe>
    <runtime>java8</runtime>

    <system-properties>
        <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
    </system-properties>

   <env-variables>
        <env-var name="ENDPOINTS_SERVICE_NAME" value="myapp-staging.appspot.com" />
    </env-variables>

</appengine-web-app>

从开发机运行时,我可以使用以下命令成功部署到GAE

I can successfully deploy to GAE with the following comand when run from my development machine

mvn -D skipTests清洁程序包appengine:deploy

推荐答案

对于Java 8运行时,您必须使用maven命令。

For Java 8 runtime, you have to use the maven command.

尝试此步骤

steps:
  - name: "gcr.io/cloud-builders/mvn"
    args: ["-D", "skipTests", "clean", "package", "appengine:deploy"]

让我知道它是否有效。

否则,如果您不使用App Engine Java8特殊风格,则可以切换到Java11运行时。

Else, you can switch to Java11 runtime if you don't use App Engine Java8 special flavor.

这篇关于使用Cloud Build将Java App部署到GAE Standard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 12:25