问题描述:导入两个坐标后,出现了红色波浪线
查看本地仓库文件,下载的只有一个文件后缀为.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