maven常见问题

常见出现以下情况,无法下载:

Could not transfer artifact org.springframework:spring-webmvc:pom:5.2.0.RELEASE from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.40.215] failed: Connection timed out: connect

Cannot resolve plugin org.apache.maven.plugins:maven-site-plugin:3.3
Cannot resolve plugin org.apache.maven.plugins:maven-clean-plugin:2.5
Cannot resolve plugin org.apache.maven.plugins:maven-resources-plugin:2.6
Cannot resolve plugin org.apache.maven.plugins:maven-jar-plugin:2.4
Cannot resolve plugin org.apache.maven.plugins:maven-compiler-plugin:3.1
Cannot resolve plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4
Cannot resolve plugin org.apache.maven.plugins:maven-install-plugin:2.4
Cannot resolve plugin org.apache.maven.plugins:maven-deploy-plugin:2.7
Cannot resolve plugin org.apache.maven.plugins:maven-site-plugin:3.3
Cannot resolve plugin org.apache.maven.plugins:maven-clean-plugin:2.5
Cannot resolve plugin org.apache.maven.plugins:maven-install-plugin:2.4
Cannot resolve plugin org.apache.maven.plugins:maven-deploy-plugin:2.7
Cannot resolve plugin org.apache.maven.plugins:maven-site-plugin:3.3


原因分析:

处理方法:

一、maven未安装。

参考:https://www.cnblogs.com/code906/p/12666896.html



二、maven被墙

第一种

网上搜到的最简单粗暴的办法就是换用阿里云的 Maven 仓库,但各位是否思考过一个问题,如果阿里云的 Maven 仓库也没有这个依赖怎么办?
所以我们可以使用阿里云的 Maven 仓库作为首选地址,再添加一个备用的地址,如:

我们可以在本地 maven 的配置文件 setting.xml 中做如下配置:
maven常见问题_第1张图片
setting.xml文件在maven对应的安装目录下conf文件夹内


    nexus-aliyun
    central
    Nexus aliyun
    http://maven.aliyun.com/nexus/content/groups/public


    spring-libs-milestone
    central
    Spring Milestones
    http://repo.spring.io/libs-milestone

基本上 90% 以上的 Maven 依赖下载失败都能够解决。

你可能感兴趣的:(maven常见问题)