maven下载失败
解决方法:
第一步:检查远程仓库
首先到本地仓库(.m2\repository)中,查看无法下载的组件。
在该组件的文件夹下,会生成后缀为.lastupdate的文件。
打开该文件,内容如下:
复制链接http://nexus.dev.qianmi.com/nexus/content/groups/public,在浏览器中打开,看看服务器上有没有你要的jar包。
如果公司有私服,最好还需要到nexus私服上看看你要的jar包是否存在。
第二步:删除本地的repository库中所有.lastupdate后缀文件,重新下载
使用文件搜索工具搜索.lastupdate后缀文件。删除所有以.lastupdate结尾的文件。
然后简单修改.pom, 保存,maven就会重新下载jar包!
第三步:maven添加镜像地址
如果还有些jar包不能下载,编辑maven的conf文件夹下settings.xml。
在 mirrors中增加
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>nexus-aliyun</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</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>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>
</mirrors>
第一个镜像配置的是阿里云的,在国内算速度比较快的,但是不能把nexus-aliyun 写成* ,这样的话阿里镜像库就代理了所有的仓库,结果是有些资源无法找到(阿里库里面资源不全)。
添加保存后,重新编辑pom文件,重新下载jar包。