自动构建SB项目,pom.xml报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.

 

使用idea自动构建springboot项目,出现Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.RELEASE from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.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  报错。即无法传输某个jar包(无法传输org.springframework.boot:spring boot starter parent:pom:2.2.6.RELEASE from https://repo.maven.apache.org/maven2已缓存在本地存储库中,在超过中心的更新间隔或强制更新之前,不会重新尝试解析。原始错误:无法传输项目org.springframework.boot:spring boot starter parent:pom:2.2.6.RELEASE from/to central(https://repo.maven.apache.org/maven2):连接到repo.maven.apache.org:443[repo.maven.apache.org/151.101.40.215]失败:连接超时:连接【百度翻译得】)

自动构建SB项目,pom.xml报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.

自动构建SB项目,pom.xml报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.

自动构建SB项目,pom.xml报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.

自动构建SB项目,pom.xml报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.

自动构建SB项目,pom.xml报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.

自动构建SB项目,pom.xml报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.

排错思路:

1 将版本号从报错得2.2.6 改成 2.0.1。改好后maven->reimport之后整个文件的报错都没了

自动构建SB项目,pom.xml报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.

自动构建SB项目,pom.xml报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.

2 虽然第一种可以解决问题,但是我还是好奇为什么IDEA自动配的2.2.6版本会报错,为什么这个版本会传输失败?已经缓存是什么意思?因为在本地已经缓存了这个版本号的一部分了,因为失去连接然后导致剩余部分没缓存在本地,然后每次从云上拉取这个版本好的JAR包时,因为本地有这个版本号(但是是不完整的)所以冲突 导致无法从云上拉取,导致报错  这样吗?

然后百度 百度到一篇https://blog.csdn.net/sinat_32238399/article/details/84553314?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522158676657219724839243855%2522%252C%2522scm%2522%253A%252220140713.130056874..%2522%257D&request_id=158676657219724839243855&biz_id=0&utm_source=distribute.pc_search_result.none-task-blog-all_SOOPENSEARCH-1     异常 - idea -Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.0.1.RELEASE 。(这篇是说把maven的setting.xml文件中的阿里云云镜像给注释掉)

通过这篇我找到错误的原因是 自动产生的springboot项目的maven依赖是自己自定义的(不是我电脑安装maven的位置,通过cmd 执行maven -v 查看  或  查看环境变量)。改错方法  只要将spring boot项目的maven依赖改成 本地安装的的maven位置就不再报错了

自动构建SB项目,pom.xml报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.

自动构建SB项目,pom.xml报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.

自动构建SB项目,pom.xml报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.

思考:通过这次自动构建出错,1 查看了下别的项目的maven依赖 发现该项目maven依赖也不是本地安装的(环境变量和cmd出来的才是本地安装的),但是maven3.6.1 是别人发我的maven版本,虽然我没有在我电脑上安装,但是项目也是可以依赖在上面的。

自动构建SB项目,pom.xml报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2.2.6.

2 报错时,我最开始打算从本地安装maven配置文件的本地仓库下手,但是连maven被安装在哪都不知道,也不知道怎么找 还得百度才找到,感觉基础知道长时间没用然后就忘的超快,最好有个文档记录  tomcat  jdk  maven 呀这些比较基础的配置,环境,测试  位置之类的信息  方便查找

3 当需要找如何配置maven的我自己博客上的文档时,我不清楚我到底有记录过吗 ?通过文档名字还蛮繁杂的找  而且还没找到。说明我需要一个简洁明了的对所有文档的总的记录,其次文章标题应该尽量清晰一些。(我的博客多是用来记录东西以备自己需要时看的,所以蛮乱的,虽然给自己看其实也还是需要多整理整理吧,以后力求文档结构清晰,还有好多需要改进)

 

<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>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
     
    <mirror>
        <id>nexus-aliyun</id>
        <mirrorOf>*</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
  </mirrors>

 

 

<!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
  <localRepository>F:\MAVEN\repository</localRepository>

 

https://www.cnblogs.com/lq147760524/p/6906025.html  maven 配置