maven setting为什么需要配置镜像
哈哈
阅读:782
2021-03-31 21:23:38
评论:0
为什么需要配置maven国内镜像?
1、
在不配置镜像的情况下,maven默认会使用中央库.
2、maven中央库在国外,有时候访问会很慢,尤其是下载较大的依赖的时候,有时候速度会很慢,甚至会出现无法下载的情况.
3、为了解决依赖下载速度的问题,需要配置maven国内镜像
镜像配置方式和比较
1、 maven镜像有两种配置,一种是在settings.xml中进行配置,第二种是在pom.xml中进行配置.
2、在settings.xml中进行配置会对所有maven工程有效,当在升级maven版本的时候,需要注意复制已经配置好的settings.xml到新的maven目录下
3、使用第一种配置pom.xml的方式只会对当前工程有效,本文建议大家使用第二种配置方式。.
配置国内maven镜像(阿里云镜像)
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
-->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
声明
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。