我目前正在尝试从Cloud Endpoints 1.0
迁移到Cloud Endpoints Frameworks 2.0
。
我已按照此处列出的步骤操作: https://cloud.google.com/appengine/docs/java/endpoints/migrating?authuser=0
在build.gradle
我已更换:
compile 'com.google.appengine:appengine-endpoints:1.9.42'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.42'
使用:
compile 'com.google.endpoints:endpoints-framework:2.0.0-beta.5'
compile 'javax.inject:javax.inject:1'
在web.xml
我已将SystemServiceServlet
替换为EndpointsServlet
,将/_ah/spi/*
替换为/_ah/api/*
。
但是在编译时,我收到以下错误:
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
我错过了什么吗?
根据@saiyr的要求编辑,这是我的build.gradle
文件:
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
}
}
更新
现在有一份指南详细介绍了此过渡流程: 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
答案 0 :(得分:3)
由于Gradle插件正在更新中,现在您需要注释掉/删除endpoints
片段,以便在构建时不生成客户端库。然后,如果您需要生成客户端库,请暂时执行manually。
答案 1 :(得分:0)
现在提供新插件,转换指南: 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)
请勿忘记遵循迁移指南: https://cloud.google.com/appengine/docs/java/endpoints/migrating?authuser=0
答案 2 :(得分:-2)
嗨,不知道你是否已经修好了,但这解决了我的问题
编译'com.google.endpoints:endpoints-framework:2.0.0-beta.9'