前言
项目跑不起来,idea依赖的jar包下面有红线,clean报错(其他命令都一样),本地仓库有对应jar包,查了很多的解决方法也试了很多,虽然问题还没解决,但是可以记录一下,下次不要再踩这些找到过的坑了。
一、代理问题(公司办公环境启用了代理服务进行联网)
-
报错信息:
Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.0.4.RELEASE from/to nexus-aliyun
或者
Connection timed out -
问题描述:
创建工程后spring-boot-starter-parent等依赖标红,因为对应的依赖找不到,下载时报错。
maven的settings.xml文件中配置的是阿里云镜像后依然无法下载。 -
解决办法:
在settings.xml文件中添加代理设置,把账户密码,端口信息修改为自己在公司中的相应配置即可:
<proxies>
<proxy>
<id>myProxy</id>
<active>true</active>
<protocol>http</protocol>
<host>123.123.123.123</host>
<port>8080</port>
<username>XXXXX</username>
<password>XXXXX</password>
<nonProxyHosts>*.XXX.com|XXX.org</nonProxyHosts>
</proxy>
</proxies>
<!-nonProxyHost表示不需要代理访问的地址。中间的竖线分隔多个地址,此处可以使用星号作为通配符号。-->
-
原因:
报错信息很明确的指出了连接超时(可能是网络问题),公司办公环境启用了代理服务进行联网,因此无法直接访问阿里云仓库进行下载。 -
参考链接:
https://blog.csdn.net/z714405489/article/details/98728736
https://blog.csdn.net/qq_27088383/article/details/89360855
二、证书校验问题
-
报错信息:
could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.2.5.RELEASE from/to nexus-aliyun (https://maven.aliyun.com/nexus/content/groups/public): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -
问题描述:
使用maven下载jar包,无法下载,报错信息:无法找到请求目标的有效认证路径 -
解决方法:
方法一
在Maven命令后加入参数“-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true”
这样设置可以跳过证书检查,然后maven clean,compile,再install就可以解决这个问题了
方法二、在Maven命令后加入参数:
-Dmaven.multiModuleProjectDirectory=$MAVEN_HOME
-Dmaven.wagon.http.ssl.insecure=true
-Dmaven.wagon.http.ssl.allowall=true
-Dmaven.wagon.http.ssl.ignore.validity.dates=true
-
原因:
阿里云仓库地址为https://maven.aliyun.com/nexus/content/groups/public,用了https作为安全协议,需要客户端通过ssl协议认证访问。 -
参考链接:
https://blog.csdn.net/xxaann/article/details/104794669
https://blog.csdn.net/jsp_will/article/details/87951082
三、代理多余
-
报错信息:
Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.5.21.RELEASE from/to default from/to default (http://maven.aliyun.com/nexus/content/groups/public): Access denied to: http://maven.aliyun.com/nexus/content/groups/public/org/springframework/boot/spring-boot-starter-parent/1.5.21.RELEASE/spring-boot-starter-parent-1.5.21.RELEASE.pom , ReasonPhrase:Forbidden. and ‘parent.relativePath’ points at no local POM @ line 5, column 13 -
问题描述:
报错意思是无法去仓库http://maven.aliyun.com/nexus/content/groups/public下载spring-boot-starter-parent:pom:1.5.21.RELEASEjar包,ReasonPhrase:禁止访问。 -
解决办法:
在settings.xml文件中删除代理: -
原因:
下载失败,跟网络有关。 -
参考链接:
https://blog.csdn.net/weixin_40453395/article/details/93755362
四、项目不引用本地仓库jar包
该问题未找到原因,待更新。
https://blog.csdn.net/lvshaorong/article/details/80334351