我包含最新版本的Google API客户端(用于与AppEngine端点进行交互)。
组装时我遇到了这个崩溃:
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':backend:endpointsDiscoveryDocs'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:537)
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:448)
at com.google.api.server.spi.ObjectMapperUtil.createStandardObjectMapper(ObjectMapperUtil.java:75)
at com.google.api.server.spi.ObjectMapperUtil.createStandardObjectMapper(ObjectMapperUtil.java:62)
at com.google.api.server.spi.tools.GenClientLibAction.<clinit>(GenClientLibAction.java:37)
at com.google.api.server.spi.tools.EndpointsTool.<init>(EndpointsTool.java:55)
at com.google.cloud.tools.gradle.endpoints.framework.server.task.GenerateDiscoveryDocsTask.generateDiscoveryDocs(GenerateDiscoveryDocsTask.java:122)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:731)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:705)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
... 27 more
我检查了我的依赖项:
+--- com.google.apis:google-api-services-oauth2:v1-rev129-1.22.0
| \--- com.google.api-client:google-api-client:1.22.0
| +--- com.google.oauth-client:google-oauth-client:1.22.0
| | +--- com.google.http-client:google-http-client:1.22.0
| | | \--- com.google.code.findbugs:jsr305:1.3.9 -> 3.0.1
| | \--- com.google.code.findbugs:jsr305:1.3.9 -> 3.0.1
| +--- com.google.http-client:google-http-client-jackson2:1.22.0
| | +--- com.google.http-client:google-http-client:1.22.0 (*)
| | \--- com.fasterxml.jackson.core:jackson-core:2.1.3
| \--- com.google.guava:guava-jdk5:17.0
如您所见,jackson-core
的版本为2.1.3
。
但是,函数com.fasterxml.jackson.core.JsonFactory.requiresPropertyOrdering()Z
的第一个声明发生在2.3版本中:
Google图书馆是否链接了错误的jackson-core
版本?
如果相关,则在将我的v1 Google Cloud Endpoints代码迁移到v2的过程中会发生这种情况。
当我从Google API客户端删除依赖项或强行升级时,会发生同样的错误。
升级时的依赖关系树示例:
+--- com.google.apis:google-api-services-oauth2:v1-rev129-1.22.0
| \--- com.google.api-client:google-api-client:1.22.0
| +--- com.google.oauth-client:google-oauth-client:1.22.0
| | +--- com.google.http-client:google-http-client:1.22.0
| | | \--- com.google.code.findbugs:jsr305:1.3.9 -> 3.0.1
| | \--- com.google.code.findbugs:jsr305:1.3.9 -> 3.0.1
| +--- com.google.http-client:google-http-client-jackson2:1.22.0
| | +--- com.google.http-client:google-http-client:1.22.0 (*)
| | \--- com.fasterxml.jackson.core:jackson-core:2.1.3 -> 2.6.0
| \--- com.google.guava:guava-jdk5:17.0
Gradle片段我用来升级依赖项:
configurations {
all {
resolutionStrategy {
force 'com.fasterxml.jackson.core:jackson-core:2.6.0'
force 'com.fasterxml.jackson.databind:jackson-databind:2.6.0'
}
}
}
Gradle片段我曾经删除过依赖项:
compile "com.google.apis:google-api-services-oauth2:v1-rev129-1.22.0", {
exclude group: "com.fasterxml.jackson.core", module: "jackson-core"
}
似乎可能还有一个问题。同步时出现以下错误:
14:13:27.882 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.google.api.server.spi.tools.GenClientLibAction
14:13:27.882 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.api.server.spi.tools.EndpointsTool.<init>(EndpointsTool.java:55)
14:13:27.882 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at com.google.cloud.tools.gradle.endpoints.framework.server.task.GenerateDiscoveryDocsTask.generateDiscoveryDocs(GenerateDiscoveryDocsTask.java:122)
14:13:27.882 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
这种失败的同步可能会使构建每次都失败。
答案 0 :(得分:0)
Endpoints框架需要比客户端库更新版本的Jackson。如果您在同一个库中有客户端库和Endpoint框架,则应从客户端库中排除Jackson依赖项。
答案 1 :(得分:0)
这个问题已通过一个黑客解决方案得到解决。
github issue tracker for the Google Cloud Platform上存在问题。
solution itself can be found here。
简而言之,修复是将所有buildscript依赖项移动到根项目build.gradle
文件中。
关于该bug的建议是在root中添加所有buildscript依赖项。所以只需从后端/ build.gradle / buildscript - &gt;移动所有内容build.gradle / buildscript,因此依赖项被强制为最新版本。