maven的配置文件中已经配置了阿里云镜像但是仍然会从中央仓库下载maven依赖很慢-解决方案

觉得有用的话,欢迎一起讨论相互学习~

我的微博我的github我的B站

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/mulinsen77/article/details/86601157

配置阿里云镜像之后依然从中央仓库下载镜像的问题解决方案:

在pom.xml文件中加上下面的代码即可。

<repositories>
    <repository>
        <id>nexus-aliyun</id>
        <name>nexus-aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>

上述解决方案的前提是已经在maven中配置好了阿里云镜像。:
在maven/.m2/repository/settings.xml文件以及maven/apache-maven-3.5.4/conf/settings.xml文件中加上阿里云的镜像:

<mirror>
        <id>nexus-aliyun</id>
        <mirrorOf>*</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
  • 注意id标签和name标签的匹配
Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐