IDEA给中央maven库添加阿里云镜像
IDEA使用maven工程的时候需要导入jar包坐标,maven工程自动下载相关jar包,但是下载实在是太慢,所以需要自己去添加一个阿里云镜像去提高下载速度。
第一步:配置自己的中央maven库,file =》setting =》Bulid =》Build Tools=》Maven
此处图片中选择的都是自己安装IDEA的位置,不要选择IDEA自带的maven库。这三个位置最好就是自己安装的位置中的文件。
如果没有哦找到user setting file,按照下面图片的操作右键点击项目名称可以找到一个create setting xml或者open setting xml
配置完成后,就可以在setting.xml中添加阿里云镜像了。在setting.xml文件中找到mirrors,在里面添加阿里云镜像下面的代码即可,这里的代码不只有阿里云镜像,还有我添加的其他镜像配置。
<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>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<!-- 阿里云镜像 -->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/nexus/content/repositories/central/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
<mirror>
<id>nexus-public-snapshots</id>
<mirrorOf>public-snapshots</mirrorOf>
<url>http://maven.aliyun.com/nexus/content/repositories/snapshots/</url>
</mirror>
<mirror>
<id>nexus</id>
<name>internal nexus repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>uk</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://uk.maven.org/maven2/</url>
</mirror>
<mirror>
<id>CN</id>
<name>OSChina Central</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
到这,阿里云镜像就添加完了,我们就可以看见maven工程下载jar速度快了很多。