maven添加阿里云镜像仓库

朱雀 2022-06-01 06:42 478阅读 0赞

现在我们大多数java项目都使用maven来管理我们的依赖包,默认情况我们会从国外的maven中心仓库下载依赖,这样就造成下载速度较慢的问题。我们可以通过添加阿里云镜像提高maven下载依赖包的速度。

  1. 打开maven安装文件的settings.xml文件,默认情况都会在C:\Users\userxx\.m2下面,这里userxx是你的使用用户名称。

添加下面的语句:

  1. <mirrors>
  2. <mirror>
  3. <id>nexus-aliyun</id>
  4. <mirrorOf>*</mirrorOf>
  5. <name>Nexus aliyun</name>
  6. <url>http://maven.aliyun.com/nexus/content/groups/public</url>
  7. </mirror>
  8. </mirrors>

添加完成后settings.xml文件如下:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  5. <mirrors>
  6. <mirror>
  7. <id>nexus-aliyun</id>
  8. <mirrorOf>*</mirrorOf>
  9. <name>Nexus aliyun</name>
  10. <url>http://maven.aliyun.com/nexus/content/groups/public</url>
  11. </mirror>
  12. </mirrors>
  13. </settings>

发表评论

表情:
评论列表 (有 0 条评论,478人围观)

还没有评论,来说两句吧...

相关阅读

    相关 maven添加阿里镜像仓库

    现在我们大多数java项目都使用maven来管理我们的依赖包,默认情况我们会从国外的maven中心仓库下载依赖,这样就造成下载速度较慢的问题。我们可以通过添加阿里云镜像提高ma