解决IDEA Maven 下载依赖包速度过慢问题 实测有效

解决IDEA Maven 下载依赖包速度过慢问题 ,jar包下载过慢,有一部分网络原因,很大一部分是因为需要请求到国外镜像仓库,响应比较慢

右键点击项目,找到maven,选择 Open ‘settings.xml’或者Create ‘settings.xml’

将以下代码粘入文件中,重启idea即可提高速度

idea超级镜像库,这是阿里云镜像库和junit镜像库

<?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">
<mirrors>
 
<!--    <mirror>-->
<!--      <id>mirrorId</id>-->
<!--      <mirrorOf>repositoryId</mirrorOf>-->
<!--      <name>Human Readable Name for this Mirror.</name>-->
<!--      <url>http://my.repository.com/repo/path</url>-->
<!--    </mirror>-->
 
    <mirror>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
 
    <mirror>
        <id>uk</id>
        <mirrorOf>central</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://uk.maven.org/maven2/</url>
    </mirror>
 
    <mirror>
        <id>CN</id>
        <name>OSChina Central</name>
        <url>http://maven.oschina.net/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
 
    <mirror>
        <id>nexus</id>
        <name>internal nexus repository</name>
        <url>http://repo.maven.apache.org/maven2</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
 
    <!-- junit镜像地址 -->
    <mirror>
        <id>junit</id>
        <name>junit Address/</name>
        <url>http://jcenter.bintray.com/</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
 
<!--    <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>mirrorId</id>
          <mirrorOf>repositoryId</mirrorOf>
          <name>Human Readable Name for this Mirror.</name>
          <url>http://my.repository.com/repo/path</url>
        </mirror>
         -->
 
        <mirror>
            <!--This sends everything else to /public -->
            <id>nexus-aliyun</id>
            <mirrorOf>*</mirrorOf>
            <name>Nexus aliyun</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
        </mirror>
 
        <mirror>
            <id>osc</id>
            <mirrorOf>*</mirrorOf>
            <url>http://maven.oschina.net/content/groups/public/</url>
        </mirror>
 
        <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>net-cn</id>
            <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://maven.net.cn/content/groups/public/</url>
        </mirror>
 
        <mirror>
            <id>ui</id>
            <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://uk.maven.org/maven2/</url>
        </mirror>
 
        <mirror>
            <id>ibiblio</id>
            <mirrorOf>central</mirrorOf>
            <name>Human Readable Name for this Mirror.</name>
            <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
        </mirror>
 
        <mirror>
            <id>jboss-public-repository-group</id>
            <mirrorOf>central</mirrorOf>
            <name>JBoss Public Repository Group</name>
            <url>http://repository.jboss.org/nexus/content/groups/public</url>
        </mirror>
 
        <mirror>
            <id>JBossJBPM</id>
            <mirrorOf>central</mirrorOf>
            <name>JBossJBPM Repository</name>
            <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
        </mirror>
 
    </mirrors>
</settings>
 

解决IDEA Maven 下载依赖包速度过慢问题_idea maven下载慢_离岸&南墙的博客-CSDN博客

  • 20
    点赞
  • 34
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Maven是一个流行的构建和依赖管理工具,当解析Maven依赖项很时,可能是由以下几个原因导致的: 1. 网络连接问题Maven需要从远程仓库下载依赖项,如果网络连接不稳定或者速度,解析依赖项就会变。可以尝试检查网络连接或切换到其他网络环境。 2. 本地仓库问题Maven会将已解析的依赖项缓存在本地仓库中,如果本地仓库中没有相应的依赖项,或者本地仓库的路径设置不正确,会导致解析依赖项变。可以尝试清理本地仓库,并确保本地仓库的路径正确配置。 3. 依赖项版本冲突:Maven解析依赖项时,可能会遇到版本冲突的情况,这会导致解析过程变。可以通过查看Maven的日志输出,找到版本冲突的依赖项,并排除或升级其中一个依赖项,解决版本冲突问题。 4. 配置文件问题Maven有多个配置文件,如settings.xml和pom.xml,配置不正确可能导致解析依赖项变。可以检查这些配置文件,确保其中的镜像和代理设置正确,并且没有额外的冗余配置。 5. 依赖项镜像源问题Maven默认使用中央仓库(Central Repository)来下载依赖项,但有时该镜像源可能不稳定或速度。可以尝试配置其他可靠的镜像源,如阿里云、华为云等,从而加快依赖项的下载速度。 总之,解决Maven依赖项解析问题需要从网络连接、本地仓库、版本冲突、配置文件和镜像源等方面进行排查和调试。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值