Maven默认中央仓库下载jar包在国内可能会很慢,我们可以通过未Maven配置国内阿里云镜像提高jar包下载速度。
-
修改setting.xml,在mirrors节点下加入一个新的mirror节点,配置阿里镜像地址,完整配置如下:
-
更换国内源 阿里巴巴开源镜像站
-
<mirrors> <mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> </mirrors>
-
修改项目pom.xml,在repositories节点下加入repository节点,配置阿里镜像地址,完整配置如下
-
<!--发现依赖和扩展的远程仓库列表。 --> <repositories> <repository> <!--远程仓库唯一标识符。可以用来匹配在settings.xml文件里配置的远程仓库 --> <id>nexus-aliyun</id> <!--远程仓库名称 --> <name>Nexus aliyun</name> <!--远程仓库URL,按protocol://hostname/path形式 --> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </repository> </repositories>