4
votes

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

I've followed the steps outlined here: https://cloud.google.com/appengine/docs/java/endpoints/migrating?authuser=0

In my build.gradle I've 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.xml I've replaced SystemServiceServlet with EndpointsServlet and /_ah/spi/* with /_ah/api/*.

However on compile, 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

Am I missing something?

Edit, as requested by @saiyr, here's my build.gradle file:

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 now a guide detailing the transition process here: https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin/blob/master/ANDROID_README.md

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

3
No, you aren't missing anything. The Gradle App Engine plugin has not yet been updated to use the beta library, unfortunately. What build task are you using? - saiyr
@saiyr Damn, all I'm trying to do is use Firebase Auth now mentioned on the Cloud Endpoints landing page but it seems in this recent Google Cloud Platform Blog post it's only for the new beta and that's why I'm trying to migrate across. I use Gradle's appengineUpdate task to build and deploy my backend. Is my assumption correct I have to migrate from Cloud Endpoints 1.0 to Cloud Endpoints Frameworks 2.0 to use Firebase Auth? - gbhall
Yes, you need to use 2.0. It surprises me that gradle appengineUpdate would trigger the appengineEndpointsGetClientLibs task. Is this an Android Studio file? Can you post your build.gradle? - saiyr
The appengineEndpointsGetClientLibs only runs automatically when configured in your build.gradle file. The latest release of the plugin (1.9.42) doesn't handle the newest version of endpoints at the moment. Filed an issue here for tracking : github.com/GoogleCloudPlatform/gradle-appengine-plugin/issues/… - loosebazooka
@saiyr, correct, this is using Android Studio. I've edited my post with my build.gradle file (I've reverted back to 1.0 by commenting out 2.0). Note the error I copied was also from when gradle syncs. As you work on endpoints, any idea when support for 2.0 will be released? I'm not sure how to upgrade without proper gradle support. PS thank you for your work! - gbhall

3 Answers

3
votes

Since the Gradle plugin is in the progress of being updated, for now you need to comment out/delete the endpoints fragment so that client libraries aren't generated on build. Then, if you need to generate client libraries, do it manually for now.

-2
votes

Hi don't know if you fixed it already but this solved my problem

compile 'com.google.endpoints:endpoints-framework:2.0.0-beta.9'