在日常生活中,我们使用maven下载需要的jar包,但是很多的时候由于中央仓库没有,所以我们没有办法下载到需要的jar包,手动去下载上,然后放入到lib下,然后build path有的时候会感到很不舒服,不是很是不实用。所以此处可以在maven的设置中心添加多个下载仓库,这样丰富了中央仓库的下载地址。
本人使用的本地的maven(版本为3.1.1)。具体配置如下:
1、配置idea指定本地仓库的maven
file-->Other Settings-->default settings-->搜索maven
2、配置本地maven(本地maven仓库存放的位置)
3、核心配置(配置多个中央下载仓库中心)
mirrorId repositoryId Human Readable Name for this Mirror. http://my.repository.com/repo/path -->mirrorId repositoryId Human Readable Name for this Mirror. http://my.repository.com/repo/path repo2 central Human Readable Name for this Mirror. http://repo2.maven.org/maven2/ alimaven aliyun maven http://maven.aliyun.com/nexus/content/groups/public/ central ui central Human Readable Name for this Mirror. http://uk.maven.org/maven2/ ibiblio central Human Readable Name for this Mirror. http://mirrors.ibiblio.org/pub/mirrors/maven2/ jboss-public-repository-group central JBoss Public Repository Group http://repository.jboss.org/nexus/content/groups/public CN OSChina Central http://maven.oschina.net/content/groups/public/ central net-cn central Human Readable Name for this Mirror. http://maven.net.cn/content/groups/public/ JBossJBPM central JBossJBPM Repository https://repository.jboss.org/nexus/content/repositories/releases/
重要说明:
此处指定多个mirrors镜像,镜像只会执行第一个位置mirror。
官网说明如下:http://maven.apache.org/guides/mini/guide-mirror-settings.html
设置多个镜像只会识别第一个镜像下载jar包。配置的多个mirror可以都放着不影响,选取一个镜像下载比较快的放在第一个就行。
到此这篇关于maven仓库中心mirrors配置多个下载中心(执行最快的镜像)的文章就介绍到这了,更多相关maven mirrors配置多个下载中心内容请搜索考高分网以前的文章或继续浏览下面的相关文章希望大家以后多多支持考高分网!



