问题:

maven安装完成,环境变量配置没有问题,cmd窗口运行mvn compile的时候报错如下:

Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: 
Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6: 
Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.52.215] failed: Connection timed out: connect -> [Help 1]

解决方案:

1. 经红色字体可以得知,不能在https://repo.maven.apache.org/maven2这个网址下载到maven-resources-plugin:jar:2.6jar包,于是我浏览器访问了红色网址,可以访问的到。

2. 我把从其他地方得到的2.6的maven-resources-plugin jar包和pom相关文件放到maven指定的目录下,可是错误依旧,尝试失败。

3. 从网上搜到这种问题的解决方案之一:是在pom.xml中加入依赖如下,有些人用这个方法解决了问题,但是我的问题依旧。

<dependency>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-resources-plugin</artifactId>
  <version>2.6</version>
</dependency>

4. 开始放大招了,最后搜索到一种方法,直接把maven安装文件夹的conf文件夹下的 settings.xml文件配置如下:

<mirrors>

    <!-- maven官方镜像 -->
<mirror>
<id>mirrorId</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name </name>
<url>http://repo1.maven.org/maven2/</url>
</mirror> <!-- 阿里云镜像1 -->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://central.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- 阿里云镜像2 -->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
<mirrorOf>central</mirrorOf>
</mirror> </mirrors>

  最后问题得以解决。这种问题出现的原因就是,联通的网段,无法访问maven.org网站。

  最后感谢博主提供了答案:https://www.cnblogs.com/1446358788-qq/articles/9597877.html

Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central的更多相关文章

  1. 彻底解决Could not transfer artifact org.apache.maven.plugins问题

    今天在学习maven框架的时候出现Could not transfer artifact org.apache.maven.plugins问题,后面根据很多博客综合总结,终于解决了,现在分享一下我的方 ...

  2. 【原创】大叔经验分享(10)Could not transfer artifact org.apache.maven:maven. from/to central. Received fatal alert: protocol_version

    maven编译工程报错 [ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.2:add-source (s ...

  3. 在idea中新建完springboot项目的时候遇到问题(右键没有class选择;控制台报错:Could not transfer artifact org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.60 from/to central ....)

    一.在idea中新建完springboot项目的时候遇到问题 问题1:右键没有class选择 解决:之所以会如此,是因为项目还没完成创建完成,解决:只需等等即可,等到完全创建完成即可 问题2(报tom ...

  4. Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from 这类问题的解决方法

    最近换了台电脑,所以重新在IEDA上搭建Spring Boot环境,遇到一个问题,网上查了很久,又实践了一通,终于解决,这里把步骤详细记录下来. 问题描述:创建IDEA的Maven项目后,出现 Mav ...

  5. 解决Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.17 问题

    详细报错如下 Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.17 from http://maven ...

  6. Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4

    Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from https://repo.mave ...

  7. 解决Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4

    Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from http://uk.maven.o ...

  8. 异常Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from http://maven.aliyun.com/nexus/content/groups/public was ...

    错误异常:Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from http://maven ...

  9. maven报错 Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:3.5.0 from

    maven报错误,类似于: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:3.5.0 from http ...

随机推荐

  1. JQuery Mobile - 解决页面点击时候,页眉和页脚消失问题!

    当点击页面时候,页眉和页脚会消失!解决方法,在页面和页脚中加入: data-quicklinks="true" 实际使用代码: <div data-role="pa ...

  2. 使用Squid部署代理服务

    Squid是Linux系统中最为流行的一款高性能代理服务软件,通常用作Web网站的前置缓存服务,能够代替用户向网站服务器请求页面数据并进行缓存.简单来说,Squid服务程序会按照收到的用户请求向网站源 ...

  3. [学习笔记]Link-Cut Tree

    我终于理解了 \(LCT\)!!!想不到小蒟蒻有一天理解了!!! 1.[模板]Link Cut Tree 存个板子 #include <bits/stdc++.h> using names ...

  4. Redis---List(链表)

    1. 基本结构 Redis 早期版本存储 list 列表数据结构使用的是压缩列表 ziplist 和普通的双向链表 linkedlist,也就是元素少时用 ziplist,元素多时用 linkedli ...

  5. Windows上安装tensorflow 详细教程

    原博客转载自:https://www.cnblogs.com/lvsling/p/8672404.html 一, 前言:本次安装tensorflow是基于Python的,安装Python的过程不做说明 ...

  6. POJ 2685

    #include <iostream> #include <string> #define MAXN 26 using namespace std; int _map[MAXN ...

  7. 03-02 Java键盘录入

    键盘录入基本格式: /* 为了让程序的数据更符合开发的数据,我们就加入了键盘录入. 让程序更灵活一下. 那么,我们如何实现键盘数据的录入呢? A:导包 格式: import java.util.Sca ...

  8. [Umbraco] 入门教程(转)

    如在页面上显示Helloword. 设计:在umbraco里,最基础的一个概念是文档类型(document type),每个文档其实可以看成一个页面类型.比如我们要创建的两个页面,每个页面都需要显示自 ...

  9. Python相关在线文档手册地址

    Python相关: 五星推荐:http://python.usyiyi.cn/ Python 2.7官方中文文档:http://doc.iplaypy.com/python2/  英文:    htt ...

  10. Java读取文件加锁代码Demo(利用Java的NIO)

    本博文部分转载于:http://blog.csdn.net/wangbaochu/article/details/48546717 Java 提供了文件锁FileLock类,利用这个类可以控制不同程序 ...