maven导入坐标后出现红色波浪线

问题描述:导入两个坐标后,出现了红色波浪线

查看本地仓库文件,下载的只有一个文件后缀为.lastUpdated的文件:

打开commons-lang3-3.7.pom.lastUpdated,查看文件的内容:

 #NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Thu Nov 21 21:10:51 CST 2019
@default-central-https\://repo.maven.apache.org/maven2/.lastUpdated=1574341851926
https\://repo.maven.apache.org/maven2/.error=Could not transfer artifact org.apache.commons\:commons-lang3\:pom\:3.7 from/to central (https\://repo.maven.apache.org/maven2)\: sun.security.validator.ValidatorException\: PKIX path building failed\: sun.security.provider.certpath.SunCertPathBuilderException\: unable to find valid certification path to requested target

打开httpclient-4.5.10.pom.lastUpdated,查看文件的内容:

#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Thu Nov 21 21:12:42 CST 2019
@default-central-https\://repo.maven.apache.org/maven2/.lastUpdated=1574341962446
https\://repo.maven.apache.org/maven2/.error=Could not transfer artifact org.apache.httpcomponents\:httpclient\:pom\:4.5.10 from/to central (https\://repo.maven.apache.org/maven2)\: sun.security.validator.ValidatorException\: PKIX path building failed\: sun.security.provider.certpath.SunCertPathBuilderException\: unable to find valid certification path to requested target

 

尝试办法1(未能解决问题):

设置 自动build(自动编译)

 

尝试办法2(未能解决问题):

(1)在pom文件中先注释掉报红的依赖,然后clean 一下项目,并手动删除报红那些依赖在maven仓库中已下载的相关jar包等文件

(2)再在pom文件中放开依赖信息,install 一下项目(如果有多个报红,可以先放开一个依赖install下看下这个方法管用不,不管用的话就需要找其他方法了)

 

迷茫了3秒钟,突发奇想,最终,无心插柳,解决了问题……

 

最终原因出在这里:

mybatis-generator自动生成代码插件中的一个配置:允许自动覆盖文件为true导致了jar包下载失败,将它改为false,注释刚才的两个坐标,clean一下,删除本地仓库.lastUpdated文件,最后打开注释,如下:

插曲:

测试期间,其中一个坐标可以把jar包正常下载到本地maven库,但idea中还是出现了红色波浪线,解决:注释坐标,删除它的本地maven文件,使用clean和compile命令,反复几次,最终导入成功。

 

OK,项目中使用mybatis自动生成代码插件的同学,注意下那个配置吧 ~

我是细节控、思路控  哈哈

 

THE END

 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值