Java maven无法解析对google firebase的依赖关系

Java maven无法解析对google firebase的依赖关系,java,firebase,maven,Java,Firebase,Maven,我正在gitlab ci/cd docker映像上运行mvn clean install,它抛出以下错误 [错误]未能在project bootstrap上执行目标。服务:无法解析project com的依赖项。sheeft:bootstrap.service:jar:0.0.1-SNAPSHOT:未能在com.google.firebase:firebase admin:jar:6.10.0->com.google.cloud:google cloud firestore:jar:1.9.0-

我正在gitlab ci/cd docker映像上运行
mvn clean install
,它抛出以下错误

[错误]未能在project bootstrap上执行目标。服务:无法解析project com的依赖项。sheeft:bootstrap.service:jar:0.0.1-SNAPSHOT:未能在com.google.firebase:firebase admin:jar:6.10.0->com.google.cloud:google cloud firestore:jar:1.9.0->com.google.cloud:google cloud core grpc:jar:1.79.0->io.grpc:grpc-netty-shaded:jar:1.21.0->io.grpc:grpc-core:jar:[1.21.0]:没有可用于io的版本。grpc:grpc-core:jar:[1.21.0]在指定范围内->[Help 1]

所以我在我的pom中尝试了以下方法

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.7.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.sheeft</groupId>
    <artifactId>bootstrap.service</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>Sheeft Bootstrap Service</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-core</artifactId>
                <version>1.23.0</version>
            </dependency>
            <dependency>
                <groupId>io.grpc</groupId>
                <artifactId>grpc-api</artifactId>
                <version>[1.23.0]</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.vaadin.external.google</groupId>
                    <artifactId>android-json</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- 2fa -->
        <dependency>
            <groupId>org.jboss.aerogear</groupId>
            <artifactId>aerogear-otp-java</artifactId>
            <version>1.0.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.inlaks</groupId>
            <artifactId>inlaks-util-lib</artifactId>
            <version>1.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.derby/derby -->
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20160212</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.firebase</groupId>
            <artifactId>firebase-admin</artifactId>
            <version>6.10.0</version>
            <exclusions>
                <exclusion>
                    <groupId>io.grpc</groupId>
                    <artifactId>grpc-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.grpc</groupId>
                    <artifactId>grpc-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.grpc</groupId>
                    <artifactId>grpc-netty-shaded</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-core</artifactId>
            <version>1.23.0</version>
            <exclusions>
                <exclusion>
                    <groupId>io.grpc</groupId>
                    <artifactId>grpc-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-netty-shaded</artifactId>
            <version>1.23.0</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-api</artifactId>
            <version>[1.23.0]</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>


4.0.0
org.springframework.boot

从central下载:(0 B以0 B/s速度下载)

您明确引用了grpc api版本1.21.1,该版本优先考虑从grpc core 1.23及相关版本加载瞬态相关数据。你为什么想要它们不同? 如果你想保持这样,你必须从GRPCcore中排除GRPCAPI

但更简单的处理方法是为api和core保留一个版本

Maven范围语法:

对于核心模块,其唯一严格的版本兼容性定义为:

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-api</artifactId>
<version>[1.23.0]</version>
<scope>compile</scope>
</dependency>

io.grpc
GRPCAPI
[1.23.0]
编译

您明确引用了grpc api版本1.21.1,该版本优先考虑从grpc core 1.23加载相关版本。你为什么想要它们不同? 如果你想保持这样,你必须从GRPCcore中排除GRPCAPI

但更简单的处理方法是为api和core保留一个版本

Maven范围语法:

对于核心模块,其唯一严格的版本兼容性定义为:

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-api</artifactId>
<version>[1.23.0]</version>
<scope>compile</scope>
</dependency>

io.grpc
GRPCAPI
[1.23.0]
编译

确保maven中有这些依赖项repository@DevDio它们在那里,我运行mvn CLI选项编译并成功构建。可能重复。也可能是当你在docker图像上运行它时,你没有达到你的maven repo。@Ambro-r我更新了这个问题,我查看了你共享的链接,它帮助了很多。请看一看。确保您的maven中有这些依赖项repository@DevDio它们在那里,我运行mvn CLI选项编译并成功构建。可能重复。也可能是当你在docker图像上运行它时,你没有达到你的maven repo。@Ambro-r我更新了这个问题,我查看了你共享的链接,它帮助了很多。请看一看。请检查我的编辑,因为我尝试了你刚才所说的,但我仍然得到相同的问题。我的意思是,当你指定具有不同版本的从属工件时,你告诉Maven查找范围内的版本。在您的情况下,从1.21.1到1.23.0。因此,您必须假设grpc core的兼容性范围设置为[1.21.x,1.23.x)这是不正确的,因为你可以从中心链接的POM中找到。更新了答案以澄清范围。它不起作用。我在我的lib中心存储库中找到了依赖项,但它就是找不到。Mate,它会起作用,因为maven不允许使用不同的版本。完全删除你-api部分或更新到1.23.0.请检查我的编辑,因为我尝试了您刚才所说的,但我仍然遇到相同的问题。我的意思是,当您指定具有不同版本的从属工件时,您告诉Maven查找范围内的版本。在您的情况下,从1.21.1到1.23.0。因此,您必须假设grpc core的兼容范围设置为[1.21.x,1.23.x)这是不正确的,因为你可以从中心链接的POM中找到。更新了答案以澄清范围。它不起作用。我在我的lib中心存储库中找到了依赖项,但它就是找不到。Mate,它会起作用,因为maven不允许使用不同的版本。完全删除你-api部分或更新到1.23.0.