IDEA设置Maven 镜像

 第一步:右键项目,选择Maven->Create ‘settings.xml’(已经存在的话是Open ‘settings.xml’)



第二步:在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>E:\zheng\develep\apache-maven-3.8.8\repo</localRepository>

  <!-- 镜像配置 -->
  <mirrors>
    <!-- 阿里云镜像(国内推荐首选) -->
    <mirror>
      <id>aliyun</id>
      <name>Aliyun Maven Mirror</name>
      <url>https://maven.aliyun.com/repository/public</url>
      <mirrorOf>central</mirrorOf>
    </mirror>

    <!-- 华为云镜像(备用) -->
    <mirror>
      <id>huaweicloud</id>
      <name>HuaweiCloud Maven Mirror</name>
      <url>https://repo.huaweicloud.com/repository/maven/</url>
      <mirrorOf>central</mirrorOf>
    </mirror>

    <!-- Maven中央仓库官方镜像(终极备用) -->
    <mirror>
      <id>central</id>
      <name>Maven Central</name>
      <url>https://repo1.maven.org/maven2/</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>

  <!-- 性能优化配置 -->
  <profiles>
    <profile>
      <id>optimize</id>
      <!-- 启用并行构建 -->
      <properties>
        <maven.compile.fork>true</maven.compile.fork>
        <maven.test.fork>true</maven.test.fork>
      </properties>
    </profile>
  </profiles>

  <!-- 激活优化配置 -->
  <activeProfiles>
    <activeProfile>optimize</activeProfile>
  </activeProfiles>
</settings>

第三步:在pom.xml文件上右击,选择Maven->Reimport(或者是Reload project )

注意:

  1. maven的全局配置默认路径是C:\Users[当前用户].m2\settings.xml,本人默认路径是C:\Users\user\.m2\settings.xml。
  2. maven的配置路径可以在settings中的maven中修改
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值