2
votes

I am trying to add firebase-admin dependency in my pom.xml :

<dependency>
  <groupId>com.google.firebase</groupId>
  <artifactId>firebase-admin</artifactId>
  <version>6.6.0</version>
</dependency>

But when I try to build my project using "clean install" command, I get following error :

[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

I tried by explicitly adding the dependency for grpc-core :

<dependency>
    <groupId>io.grpc</groupId>
    <artifactId>grpc-core</artifactId>
    <version>1.13.1</version>
</dependency>

This jar got downloaded to my local repository, but still the same error persists for firebase-admin.

How can I overcome this error?

2

2 Answers

1
votes

I had the same issue. I was able to resolve it by deleting the maven-metadata out of the local repo directories (for the relevant dependencies).

i.e:

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

maven-metadata-central.xml
maven-metadata-central.xml.sha1
resolver-status.properties
0
votes

I solved this by overriding grpc-core in dependency management:

<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>

The order is important. Hope this helps.