关于Maven settings.xml文件配置的mirror导致Failure to find xxx jar问题

听同事说过mirror是按顺序去下载jar包的,其实这句话是不严谨的,我是排查验证了这个问题,然后去网上检索了下答案:maven配置多个mirror时,只有当一个mirror连接不上才会启用下个mirror。
下面记录下我排查问题的过程:
package打包异常:[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-resources-plugin:jar:2.6 in http://download.osgeo.org/webdav/geotools/ was cached in the local repository, resolution will not be reattempted until the update interval of geo has elapsed or updates are forced -> [Help 1]

尝试解决:删除对应本地的Maven jar包,重新下载依赖打包

报错:Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-resources-plugin:jar:2.6 in geo (http://download.osgeo.org/webdav/geotools/)
本质还是找不到这个jar包
                        
来回来回折腾,大概发现了问题:在我的第一个镜像中总是下载不到这个jar包,差不多只是创建了个空文件夹
原因:maven配置的镜像顺序以这个开头,在这个镜像中无法找到而这个镜像又是可连接的:

geo
geo
http://download.osgeo.org/webdav/geotools/
central


答案:配置为阿里的镜像开头:
  
alimaven  
aliyun maven  
http://maven.aliyun.com/nexus/content/groups/public/  
central          

你可能感兴趣的:(Maven)