IDEA下载插件慢的问题

总体

最近刚刚上手IDEA,下载插件时发现非常慢,发现主要是是配置的问题。

可以通过将下载源定义成阿里云镜像的方法解决。

步骤

1.找到如下文件

settings.xml 是 Maven 的全局配置文件,定义了 Maven 的全局设置,如镜像仓库、代理设置、本地仓库路径等。这个文件通常位于以下目录:

Windows: C:\Users\<你的用户名>\.m2\settings.xml

Linux 和 macOS: ~/.m2/settings.xml

2.自定义文件

如果找不到文件,在步骤一的路径下创建文件。注意创建时,先选择文本文档,再另存为.xml格式文件

3.定义如下XML配置

如果是已经有xml文件,添加如下代码即可:

<mirrors>
    <mirror>
        <id>aliyun-central</id>
        <mirrorOf>central</mirrorOf>
        <name>Aliyun Maven Central</name>
        <url>https://maven.aliyun.com/repository/central</url>
    </mirror>
</mirrors>

如果是自己新建的,则添加如下的完整代码:

<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>aliyun-central</id>
            <mirrorOf>central</mirrorOf>
            <name>Aliyun Maven Central</name>
            <url>https://maven.aliyun.com/repository/central</url>
        </mirror>
    </mirrors>
  
    <profiles>
        <profile>
            <id>default</id>
            <repositories>
                <repository>
                    <id>central</id>
                    <url>https://repo.maven.apache.org/maven2</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
        </profile>
    </profiles>
  
    <activeProfiles>
        <activeProfile>default</activeProfile>
    </activeProfiles>
</settings>

4.配置完成后

配置完成后,重新运行 Maven 构建命令,如 mvn clean install,以使用新配置的镜像仓库。

总结

 Windows 上操作,一般按以下步骤:

  1. 打开文件资源管理器,导航到 C:\Users\<你的用户名>\.m2
  2. 如果 settings.xml 文件不存在,右键选择 "新建" -> "文本文件",将其命名为 settings.xml,并确保文件扩展名为 .xml 而不是 .txt
  3. 打开 settings.xml 文件,将上述配置粘贴进去并保存。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值