1.環境
win10
jdk13
Eclipse IDE for Enterprise Java Developers Version: 2019-12 (4.14.0)
apache-maven-3.6.3
2. 場景,在Eclipse創建maven項目
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-war-plugin:2.2 or one of its dependencies could not be resolved: Failure to transfer org.apache.maven.plugins:maven-war-plugin:jar:2.2 from https://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus-aliyun has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-war-plugin:jar:2.2 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
Plugin org.apache.maven.plugins:maven-war-plugin:2.2 or one of its dependencies could not be resolved: Failure to transfer org.apache.maven.plugins:maven-war-plugin:jar:2.2 from https://maven.aliyun.com/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus-aliyun has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-war-plugin:jar:2.2 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
3.問題及解決辦法
通過調試發現原因,maven鏡像配置問題如下:
<!-- 阿里雲 Maven 鏡像服務器配置 -->
<mirror>
<id>nexus-aliyun</id>
<name>Nexus aliyun</name>
<mirrorOf>*</mirrorOf>
<!--https爲報錯的配置 -->
<url>https://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
<!-- 阿里雲 Maven 鏡像服務器配置 -->
<mirror>
<id>nexus-aliyun</id>
<name>Nexus aliyun</name>
<mirrorOf>*</mirrorOf>
<!--http爲報錯的配置,問題解決 -->
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>