在我们的 Cloud Endpoint 从 v1 迁移到 V2 的过程中,我们注意到客户端生成的 Service Definition 类的名称没有使用 @Api 注解定义中定义的 canonicalName
例如
@Api(name = "customer",
canonicalName = "CustomerAPI",
version = "v1",
...
public class CustomerEndpoint {
...
生成 customer-v1-java.zip 并使用名称 Customer 而不是 CustomerAPI 生成服务定义类。
我们应用的 build.gradle 如下所示
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.cloud.tools.endpoints-framework-client'
apply plugin: 'io.fabric'
...
dependencies {
...
endpointsServer project(path: ':servers:api', configuration: 'endpoints')
}
而servers/api中的build.gradle如下
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
// App Engine Gradle plugin
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.3'
// Endpoints Frameworks Gradle plugin
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
}
}
...
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'com.google.cloud.tools.endpoints-framework-server'
...
dependencies {
providedCompile group: 'javax.servlet', name: 'servlet-api', version:'2.5'
compile 'jstl:jstl:1.2'
compile group: 'javax.inject', name: 'javax.inject', version: '1'
compile group: 'com.google.appengine', name: 'appengine-api-1.0-sdk', version: '1.9.49'
compile group: 'com.google.endpoints', name: 'endpoints-framework', version: '2.0.8'
...
}
appengine {
deploy { // deploy configuration
version = findProperty("appengine.deploy.version")
def promoteProp = findProperty("appengine.deploy.promote")
if (promoteProp != null) {
promote = new Boolean(promoteProp)
}
}
run {
host = "0.0.0.0"
port = 8080
jvmFlags = ['-Ddatastore.backing_store=../../../local_db.bin']
}
}
def projectId = 'some-api-project'
endpointsServer {
hostname = "${projectId}.appspot.com"
}
endpointsClientLibs {
hostname = "${projectId}.appspot.com"
}
为什么不尊重 canonicalName 的任何想法?