解决Maven配置了阿里镜像后仍从中央仓库下载依赖的问题

今天从github上拉了一个项目,我maven配置的是阿里的镜像,maven下载这个项目的依赖却从中央仓库下载。

新建了一个maven项目,依赖是从阿里镜像的下载的,说明阿里的镜像是正常的。

解决:在项目的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>
原文地址:https://www.cnblogs.com/chy18883701161/p/12581589.html