当我在 Eclipse 中添加 firebase-admin maven 依赖项时,出现“指定范围内没有可用的 io.grpc:grpc-core:jar:[1.13.1] 版本”错误

Sho*_*ram 3 firebase firebase-admin google-cloud-firestore

我正在尝试在 pom.xml 中添加 firebase-admin 依赖项:

<dependency>
  <groupId>com.google.firebase</groupId>
  <artifactId>firebase-admin</artifactId>
  <version>6.6.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

但是当我尝试使用“干净安装”命令构建我的项目时,出现以下错误:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Communication Manager 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://192.168.1.4:8081/artifactory/libs-release/com/google/firebase/firebase-admin/6.6.0/firebase-admin-6.6.0.pom
[INFO] Downloaded: http://192.168.1.4:8081/artifactory/libs-release/com/google/firebase/firebase-admin/6.6.0/firebase-admin-6.6.0.pom (21 KB at 44.6 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.498 s
[INFO] Finished at: 2019-01-02T11:43:59+05:30
[INFO] Final Memory: 14M/308M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project communicationmgr: Could not resolve dependencies for project com.example.server:communicationmgr:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.google.firebase:firebase-admin:jar:6.6.0 -> com.google.cloud:google-cloud-firestore:jar:0.61.0-beta -> com.google.cloud:google-cloud-core-grpc:jar:1.43.0 -> io.grpc:grpc-netty-shaded:jar:1.13.1 -> io.grpc:grpc-core:jar:[1.13.1]: No versions available for io.grpc:grpc-core:jar:[1.13.1] within specified range -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Run Code Online (Sandbox Code Playgroud)

我尝试显式添加 grpc-core 的依赖项:

<dependency>
    <groupId>io.grpc</groupId>
    <artifactId>grpc-core</artifactId>
    <version>1.13.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

这个 jar 已下载到我的本地存储库,但 firebase-admin 仍然存在相同的错误。

我怎样才能克服这个错误?

小智 5

我遇到过同样的问题。我能够通过从本地存储库目录中删除 maven-metadata 来解决这个问题(对于相关的依赖项)。

IE:

user_dir\.m2\repository\io\grpc\grpc-api

maven-metadata-central.xml
maven-metadata-central.xml.sha1
resolver-status.properties
Run Code Online (Sandbox Code Playgroud)