maven从远程仓库下载jar包时,无法下载到jar包,只有pom,sha1等文件,网上的办法都尝试过了

问题遇到的现象和发生背景

maven从远程仓库下载jar包时,无法下载到jar包,只有pom,sha1等文件

img

idea找不到文件自然报错

img

我的解答思路和尝试过的方法

1.修改setting.xml配置文件,同时也配置了阿里云镜像

img

2.在idea配置maven路径

img

3.环境变量配置,maven_home的path也配置了

img

4.删除本地仓库的文件重试,重装maven(多个版本),重装idea,都试过了,还是下不下来

我想要达到的结果

能从远程仓库正常下载jar包,不报错

这种情况,是因为下载失败了。
将本地仓库相关依赖包删除,重新下载。
idea中有没有配置maven环境,maven中配置阿里的镜像。

配置maven阿里镜像,关键代码如下

<mirror>
    <id>nexus-aliyun</id>
    <mirrorOf>central</mirrorOf>
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

配置好以后,idea里面关联maven,记得在你下载或者刷新maven之前,将你的本地仓库下的依赖全删光,然后你在idea里面刷新maven等待下载即可(ps:下载不完全的依赖如果不删掉,下次下载将会跳过)

是不是聚合工程呢


<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>nexus-aliyun</id>  
            <mirrorOf>central</mirrorOf>  
            <name>Nexus aliyun</name>  
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
        </mirror>  
        <mirror>  
            <id>net-cn</id>  
            <mirrorOf>central</mirrorOf>  
            <name>Nexus net</name>  
            <url>http://maven.net.cn/content/groups/public/</url>  
        </mirror>  
    </mirrors>  

1、setting.xml里面有上面的代码吗?检查一下。
2、圈圈点一下

img

3、清一下

img