知识混子的博客 

设置Eclipse的Maven仓库地址

by 知识混子


Posted on 星期一 2019年03月25日 at 12:03下午 in IT技术


参考文档:http://www.cnblogs.com/mvilplss/p/6102472.html

1、首先在D盘新建文件夹,D:\Maven\repository

2、在 D:\Maven 中新建文件 settings.xml 如下:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D:\Maven\repository</localRepository>
<mirrors>
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
</mirrors>

<repositories>
<repository>
<id>spring</id>
<url>https://maven.aliyun.com/repository/spring</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</settings>

3、进入Eclipse菜单 Window - Preference - Maven - User Settings,如下图所示,点 Browse... 找到上面的 settings.xml 文件,然后点 Update settings 就OK了。下面的 reindex 和 Apply 按钮似乎不需要点,也会自动更新,然后 Build。

m2e-settings.png

4、完事。本地仓库地址写在 settngs.xml 里了,会自动更新。阿里云的 Maven 仓库也写在 settings.xml 里了,今后下载包的速度会快很多。
阿里云 Maven 仓库相关信息参考:https://help.aliyun.com/document_detail/102512.html



No one has commented yet.

Leave a Comment

HTML语法: 禁用