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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM