0
votes

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

My cloudbuild.yaml is as follows :

steps: - name: "gcr.io/cloud-builders/gcloud" args: ["app", "deploy"] timeout: "1600s"

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

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

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

ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: WEB-INF/appengine-web.xml is required for this runtime.

Has anyone got this sort of build to work?

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

mvn -D skipTests clean package appengine:deploy

Edit with further information.

I'm using Java 8

Target runtime is also Java 8

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>

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

mvn -D skipTests clean package appengine:deploy

1
1)Which Java version are you using? 2)which is your target runtime? 3) can you share your xml file? 4)does mvn -D clean package appengine:deploy works? - Soni Sol
Do you build a fat jar or not ? - guillaume blaquiere
@guillaumeblaquiere : I think GAE standard expects a WAR file so I just use the maven-war-plugin and the google appengine-maven-plugin. - DaveH
The question of @JoséSoní are relevant because your runtime version is impacting on java packaging and deployment. WAR for Java 8 but (fat)Jar for JAVA11 and the app description haven't the same form and don't be place at the same directory. - guillaume blaquiere
@guillaumeblaquiere: I edited my question with responses to Jose's questions. I'm not sure about the target runtime - I assume its Java8 but I'm not sure how to specify it. - DaveH

1 Answers

3
votes

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

Try this step

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

Let me know if it works.

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