我的问题已经在这里回答了:apiKeyRequired in google cloud endpoint not getting resolved
但这对我没用。
我仍然有一个问题,即IDE无法解决apiKeyRequired属性。我正在使用端点-框架2.+。
@Api(
name = "api",
version = "v1",
apiKeyRequired = AnnotationBoolean.TRUE,
namespace = @ApiNamespace(
ownerDomain = "backendDomain.myapplication.test.example.com",
ownerName = "backendName.myapplication.test.example.com",
packagePath = ""
)
)
public class MyEndpoint {
...
build.gradle
...
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.54'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.google.appengine:appengine-endpoints:1.9.54'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.54'
compile 'com.google.endpoints:endpoints-framework:2.0.7'
}
...
发布于 2017-06-21 05:42:56
明白了!!在试图解决这个问题好几个小时之后!这个解决办法是在贴出这个问题后直接提出的。
问题在于所使用的依赖关系。build.gradle文件中的这两个依赖项导致了以下问题:
compile 'com.google.appengine:appengine-endpoints:1.9.54'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.54'
我用这两个新的家属代替了他们:
compile 'com.google.endpoints:endpoints-management-control-appengine:1.0.3'
compile 'com.google.endpoints:endpoints-framework-auth:1.0.3'
build.gradle (更新):
...
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.54'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.google.endpoints:endpoints-framework:2.0.7'
compile 'com.google.endpoints:endpoints-management-control-appengine:1.0.3'
compile 'com.google.endpoints:endpoints-framework-auth:1.0.3'
}
...
https://stackoverflow.com/questions/44677282
复制相似问题