IDEA配置maven中央库

本文详细介绍了如何配置Maven以使用阿里云等国内镜像仓库,以及如何在IntelliJ IDEA中进行相应的设置。首先,通过修改settings.xml文件,可以指定Maven使用阿里云仓库作为中央库的镜像,提高依赖下载速度。接着,在IDEA中进行配置,确保项目能够正确识别和使用这些设置。
分两步:
STEP 1:配置maven;
STEP 2:配置IDEA。区分默认配置和项目级配置。

STEP 1:maven中央库配置

 

国内常用的maven库主要是阿里云maven库、华为云maven。

其中阿里云maven库配置如下:

配置文件路径为conf/settings.xml

<mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    
     -->
        <!-- 阿里云仓库 -->
        <mirror>
            <id>alimaven</id>
            <mirrorOf>central</mirrorOf>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
        </mirror>
    
        <!-- 中央仓库1 -->
        <mirror>
            <id>repo1</id>
            <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://repo1.maven.org/maven2/</url>
        </mirror>
    
        <!-- 中央仓库2 -->
        <mirror>
            <id>repo2</id>
            <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://repo2.maven.org/maven2/</url>
        </mirror>
         <mirror>
              <id>nexus-aliyun</id>
             <mirrorOf>*</mirrorOf>
             <name>Nexus aliyun</name>
             <url>http://maven.aliyun.com/nexus/content/groups/public</url>
        </mirror>
  </mirrors>

 

STEP 2:IDEA配置

打开IDEA,按下Ctrl+Alt+S,进入配置选项界面

 

转载于:https://www.cnblogs.com/HopkinsCybn/p/10127286.html

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值