我正在尝试在pom.xml中添加firebase-admin依赖项:
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>6.6.0</version>
</dependency>
但是当我尝试使用“全新安装”命令构建项目时,出现以下错误:
[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
我尝试通过显式添加grpc-core的依赖项:
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
<version>1.13.1</version>
</dependency>
此jar已下载到我的本地存储库,但对于firebase-admin仍然存在相同的错误。
如何克服此错误?
答案 0 :(得分:0)
我通过在依赖项管理中覆盖grpc-core
来解决了这个问题:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-core</artifactId>
<version>1.13.1</version>
</dependency>
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>6.6.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
</dependency>
</dependencies>
顺序很重要。希望这会有所帮助。
答案 1 :(得分:0)
我有同样的问题。我能够通过从本地repo目录中删除maven-metadata来解决此问题(针对相关的依赖项)。
即:
user_dir\.m2\repository\io\grpc\grpc-api
maven-metadata-central.xml
maven-metadata-central.xml.sha1
resolver-status.properties