Unrecognized element '<runtime>' when upgrading Google App Engine to Java 8

Viewed 1027

I have a Google App Engine Standard server running Java 7, and would like to upgrade to Java 8. I have added <runtime>java8</runtime> to my pom.xml as follows:

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

This was described in https://cloud.google.com/appengine/docs/standard/java/runtime-java8#specifying_the_java_8_runtime_for_your_app.

However when building the application, it fails with the error Unrecognized element <runtime>. Can anyone advise?

3 Answers

You should probably be using an old version of appengine sdk currently. Check whether you have the latest version of appengine-api dependency.

I use following appengine-api and it works fine for me.

<dependency>
    <groupId>com.google.appengine</groupId>
    <artifactId>appengine-api-1.0-sdk</artifactId>
    <version>1.9.58</version>
</dependency>

i had the same issue but it turned out to be that i was using the appengine-maven-plugin ( for debugging ) and i had to up its version too.

<plugin>
   <groupId>com.google.appengine</groupId>
   <artifactId>appengine-maven-plugin</artifactId>
   <version>1.9.49</version>
   <configuration>
      <enableJarClasses>false</enableJarClasses>
      <jvmFlags>
          <jvmFlag>-Xdebug</jvmFlag>
           <jvmFlag>-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n</jvmFlag>
       </jvmFlags>
     </configuration>
  </plugin>

You have an old version of Google Cloud SDK. You can update it as follows -

Step 1. Right click on "Google Cloud SDK Shell" and click "Run as administrator"

Step 2. Run following command on command prompt opened -

gcloud components update

Congratulations! you are done. Now your error will be gone.

PS: By the way you can check Google Cloud SDK version by using this command - gcloud version

Related