对pom.xml文件进行“mvn install”命令报如下错误:
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.cloud:spring-cloud-dependencies:pom:Finchley.M7 from/to spring-milestones (https://repo.spring.io/milestone): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target @ line 43, column 16
[ERROR] 2.0.1.RELEASE for org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:jar is missing. @ line 18, column 15
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project net.common:eureka-server:1.0.0 (D:\develop\workspace\eureka-server\pom.xml) has 2 errors
[ERROR] Non-resolvable import POM: Could not transfer artifact org.springframework.cloud:spring-cloud-dependencies:pom:Finchley.M7 from/to spring-milestones (https://repo.spring.io/milestone): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target @ line 43, column 16 -> [Help 2]
[ERROR] 2.0.1.RELEASE for org.springframework.cloud:spring-cloud-starter-netflix-eureka-client:jar is missing. @ line 18, column 15
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
原因:
和SSL网络连接有关
解决方案:
可以参照博客园博主这篇文章解决:https://www.cnblogs.com/huiy/p/8664006.html.
如果原博主文章已删除,则可参考下面方式解决:
把pom.xml中repositories改成如下:
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>repository.springframework.maven.release</id>
<name>Spring Framework Maven Release Repository</name>
<url>http://maven.springframework.org/milestone/</url>
</repository>
<repository>
<id>org.springframework</id>
<url> http://maven.springframework.org/snapshot</url>
</repository>
<repository>
<id>spring-milestone</id>
<name>Spring Maven MILESTONE Repository</name>
<url>http://repo.spring.io/libs-milestone</url>
</repository>
<repository>
<id>spring-release</id>
<name>Spring Maven RELEASE Repository</name>
<url>http://repo.spring.io/libs-release</url>
</repository>
</repositories>