Maven下载依赖踩坑:Could not transfer artifact org.springframework.boot:spring-boot-starter-parent

环境:IDEA ,公司办公环境
本文只适用于启用了代理服务进行联网的情况!非此情况的朋友们还请另找原因。

创建工程后spring-boot-starter-parent等依赖标红,因为对应的依赖找不到,下载时报错误:
Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.4.RELEASE from/to nexus-aliyun
或者
Connection timed out
在maven的settings.xml文件中添加了阿里云镜像后依然无法下载。

解决办法:在settings.xml文件中添加代理设置:

    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->

把账户密码,端口信息修改为自己在公司中的相应配置即可。
终于能下载了:
在这里插入图片描述

PS:有问题及时请教前辈或同事,避免自己瞎折腾浪费时间hhhh

发布了143 篇原创文章 · 获赞 45 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/z714405489/article/details/98728736