Porting to Cloud Ends Framework 2.0 for App Engine

I'm currently trying to switch from Cloud Endpoints 1.0to Cloud Endpoints Frameworks 2.0.

I followed these steps: https://cloud.google.com/appengine/docs/java/endpoints/migrating?authuser=0

In mine, build.gradleI replaced:

compile 'com.google.appengine:appengine-endpoints:1.9.42'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.42'

with:

compile 'com.google.endpoints:endpoints-framework:2.0.0-beta.5'
compile 'javax.inject:javax.inject:1'

And in web.xmlI replaced SystemServiceServletby EndpointsServletand /_ah/spi/*by /_ah/api/*.

However, when compiling, I get the following error:

Error:Execution failed for task ':myapp_backend:appengineEndpointsGetClientLibs'.
> There was an error running endpoints command get-client-lib: web.xml must have 1 (found:0) SystemServiceServlet servlet

Did I miss something?

Change as @saiyr requested, here is my build.gradlefile:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.google.appengine:gradle-appengine-plugin:1.9.42'
    }
}

repositories {
    jcenter();
}

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

dependencies {
    // AppEngine
    appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.42'
    compile 'javax.servlet:servlet-api:2.5'

    //  Cloud Endpoints
    compile 'com.google.appengine:appengine-endpoints:1.9.42'
    compile 'com.google.appengine:appengine-endpoints-deps:1.9.42'

    // Cloud Endpoints Frameworks
    // compile 'com.google.endpoints:endpoints-framework:2.0.0-beta.7'
    // compile 'javax.inject:javax.inject:1'

    // Project
    compile files('src/main/webapp/WEB-INF/lib/gson-2.3.1.jar')
    compile 'com.googlecode.objectify:objectify:5.1.9'
    compile 'com.ganyo:gcm-server:1.0.2'
    compile 'com.google.appengine.tools:appengine-gcs-client:0.5'
}

appengine {
    downloadSdk = true
    appcfg {
        oauth2 = true
    }
    endpoints {
        getClientLibsOnBuild = true
        getDiscoveryDocsOnBuild = true
    }
}

UPDATE:

There is currently a guide describing the transition process here: https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin/blob/master/ANDROID_README.md

: https://cloud.google.com/endpoints/docs/frameworks/legacy/v1/java/migrating-android

+4

Source: https://habr.com/ru/post/1653752/


All Articles