Maven小白--常用的maven镜像中央库汇总(二)

 

Maven基础知识:

1、在日常生活中,我们使用maven下载需要的jar包,但是很多的时候由于中央仓库没有,所以我们没有办法下载到需要的jar包,手动去下载上,然后放入到lib下,然后build path有的时候会感到很不舒服,很不实用。所以此处可以在maven的设置中心添加多个下载仓库,这样丰富了中央仓库的下载地址。

2、可以指定多个mirrors镜像,但mirrorof相同,镜像只会执行第一个位置mirror。配置的多个mirror都放着不影响,选取一个镜像下载比较快的放在第一个就行。

3、这里要知道OSChina Central即开源中国的镜像已不对外开放了。

4、<mirrorOf>central</mirrorOf>  与<mirrorOf>*</mirrorOf>  
mirror尽量不要mirrorOf *,请参考 https://blog.csdn.net/qq_37358143/article/details/99548897 Maven settings配置中的mirrorOf

(mirrorof配置为*时,所有的请求都走这个mirror的url,若构件不存在也不会去中央仓库获取;mirrorof配置是某个repositoryid时,若构建找不到,则会到中央仓库去获取的。只不过由于中央仓库在国外,不方便获取而已。--忘了哪个博客里看到的了)

5、本地仓库repository,即

<localRepository>E:/JavaInstall/MavenRepository</localRepository>

repository的优先级高于mirror

配置多个中央下载仓库中心:

阿里云的

<mirror>  
	<!-- 唯一标识一个mirror -->
	<id>alimaven</id>  
	<!-- 代表了一个镜像的替代位置,例如central就表示代替官方的中央库 -->
	<mirrorOf>central</mirrorOf>  
	<!-- 貌似没多大用,相当于描述 -->
	<name>aliyun maven</name>  
	 <!-- 库地址 -->
	<url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
</mirror>
<!-- 阿里云仓库 -->
<mirror>
	<id>alimaven</id>
	<mirrorOf>central</mirrorOf>
	<name>aliyun maven</name>
	<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>  
      <id>ui</id>  
      <mirrorOf>central</mirrorOf>  
      <name>Human Readable Name for this Mirror.</name>  
     <url>http://uk.maven.org/maven2/</url>  
</mirror> 

中央仓库

<!-- 中央仓库1 -->
<mirror>
	<id>repo1</id>
	<mirrorOf>central</mirrorOf>
	<name>Human Readable Name for this Mirror.</name>
	<url>http://repo1.maven.org/maven2/</url>
</mirror>

<!-- 中央仓库2 -->
<mirror>
	<id>repo2</id>
	<mirrorOf>central</mirrorOf>
	<name>Human Readable Name for this Mirror.</name>
	<url>http://repo2.maven.org/maven2/</url>
</mirror>

<!-- 不是很清楚的 -->
<mirror>
    <id>mirrorId</id>
    <mirrorOf>repositoryId</mirrorOf>
    <name>Human Readable Name for this Mirror.</name>
    <url>http://my.repository.com/repo/path</url>
</mirror>

Jboss 的

<mirror>  
      <id>jboss-public-repository-group</id>  
      <mirrorOf>central</mirrorOf>  
      <name>JBoss Public Repository Group</name>  
   <url>http://repository.jboss.org/nexus/content/groups/public</url>  
</mirror>
没用过,也不知道对不对

Spring.Io 的

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值