首页 > 文章列表 > Maven 使用阿里镜像下载依赖速度依旧缓慢怎么办?

Maven 使用阿里镜像下载依赖速度依旧缓慢怎么办?

444 2025-02-22

Maven 使用阿里镜像下载依赖速度依旧缓慢怎么办?

maven 使用阿里镜像下载依赖速度依旧缓慢

你已经配置了阿里镜像(https://maven.aliyun.com/)作为 maven 的镜像仓库,但下载依赖的速度依然很慢。这可能是由于以下原因造成的:

你配置的阿里镜像只替换了 maven 中央仓库,而你的依赖还依赖了其他仓库中的库。在这种情况下,你需要将这些仓库的镜像地址也添加到你的 maven 配置中。

建议你加入如下仓库镜像配置:

<mirrors>
    <mirror>
        <id>central-aliyun</id>
        <mirrorOf>central</mirrorOf>
        <url>https://maven.aliyun.com/repository/public</url>
    </mirror>
    <mirror>
        <id>jcenter-aliyun</id>
        <mirrorOf>jcenter</mirrorOf>
        <url>https://maven.aliyun.com/repository/jcenter</url>
    </mirror>
    <mirror>
        <id>google-aliyun</id>
        <mirrorOf>google</mirrorOf>
        <url>https://maven.aliyun.com/repository/google</url>
    </mirror>
    <mirror>
        <id>ossrh-aliyun</id>
        <mirrorOf>ossrh</mirrorOf>
        <url>https://maven.aliyun.com/repository/ossrh</url>
    </mirror>
</mirrors>

添加这些镜像配置后,maven 将自动从这些镜像仓库下载依赖,从而提升下载速度。

来源:1729833878