现在我们大多数java项目都使用maven来管理我们的依赖包,默认情况我们会从国外的maven中心仓库下载依赖,这样就造成下载速度较慢的问题。我们可以通过添加阿里云镜像提高maven下载依赖包的速度。
1. 打开maven安装文件的settings.xml文件,默认情况都会在C:\Users\userxx\.m2下面,这里userxx是你的使用用户名称。
添加下面的语句:
<mirrors> <mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> </mirrors>添加完成后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"> <mirrors> <mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> </mirrors> </settings>