Enhancing endpoints in Cloud Endpoints Frameworks 2.0 for App Engine

▼魔方 西西 提交于 2019-12-10 10:36:36

问题


I have received an email from GCP to migrate my project 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 previous build.gradle I had this directive to enhance my endpoints and it worked fine:

appengine {
    downloadSdk = true
    appcfg {
        oauth2 = true
    }
    endpoints {
        getClientLibsOnBuild = true
        getDiscoveryDocsOnBuild = true
    }
    enhancer {
        version = "v2"
        api="jdo"  // or "jpa"
        enhanceOnBuild = true
    }
}

However, after migration and on compile, I get the following error:

Error:(60, 0) Could not find method enhancer() for arguments [build_2dn4fni12bkrsqgsi25gsx3hh$_run_closure2$_closure7@6b02ee9e] on object of type com.google.cloud.tools.gradle.appengine.core.AppEngineExtension.

And if I remove the enhancer part, I get the following error:

org.datanucleus.metadata.MetaDataManager initialiseFileMetaDataForUse: Found Meta-Data for class [...] but this class is not enhanced!! Please enhance the class before running DataNucleus.

So, what is the equivalent enhancing in the new framework? (I'm using Android Studio 2.3.3)


回答1:


The problem is that the new gradle plugin doesn't have the task appengineEnhance which is required to enhance your classes for jpa/jdo.

There's a workaround for this here https://stackoverflow.com/a/29279504/3190492

It's also worth nothing that the enhancer {...} section in the appengine block won't be required and that configuration should be done in the script in the link above.




回答2:


I got this response directly from Google Cloud Support:

There are some features and tools that are excluded and currently unavailable with the latest version of Endpoints v2. If your application requires any of the below mentioned, you are not recommended to migrate.

  • JSON-RPC protocol, which is required for legacy iOS clients
  • Automatic ETags
  • Automatic Kind fields
  • IDE integration
  • fields partial responses

Meanwhile, below are the tools that are currently not supported in v2.0:

  • Android Studio support for Cloud Endpoints 1.0
  • Android Studio code validation and quick fixes for Cloud Endpoints 1.0

So, with regards to the 'enhancer' method, have you checked if this is included on the aforementioned features? If so, the only way for you to do is check for an equivalent function or downgrade again to v1.0.

This is not the answer I hoped for, but at least till they officially support these features, we should not migrate to Endpoints Framework v2.0.



来源:https://stackoverflow.com/questions/45493314/enhancing-endpoints-in-cloud-endpoints-frameworks-2-0-for-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!