我目前正在嘗試從Cloud Endpoints 1.0
遷移到Cloud Endpoints Frameworks 2.0
。遷移到雲端點App Engine的框架2.0
我已經按照這裏列出的步驟:我把它換成
compile 'com.google.endpoints:endpoints-framework:2.0.0-beta.5'
compile 'javax.inject:javax.inject:1'
而在web.xml
:我把它換成 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'
與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
}
}
UPDATE:
現在有一個指南,詳細說明在此轉型過程: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
不,你不會錯過任何東西。遺憾的是,Gradle App Engine插件尚未更新爲使用測試版庫。你使用什麼構建任務? – saiyr
@saiyr該死的,我想要做的就是使用現在提到的[Cloud Endpoints登陸頁面](https://cloud.google.com/endpoints/)上的Firebase Auth,但它似乎在[最近的Google雲平臺博客文章](https://cloudplatform.googleblog.com/2016/09/manage-your-APIs-with-Google-Cloud-Endpoints.html)它只適用於新的測試版,這就是爲什麼我試圖遷移。我使用Gradle的'appengineUpdate'任務來構建和部署我的後端。我的假設是否正確,我必須從'Cloud Endpoints 1.0'遷移到'Cloud Endpoints Frameworks 2.0'以使用'Firebase Auth'? – gbhall
是的,你需要使用2.0。令我驚訝的是,'gradle appengineUpdate'會觸發'appengineEndpointsGetClientLibs'任務。這是一個Android Studio文件嗎?你可以發佈你的'build.gradle'嗎? – saiyr