An error occurred while downloading Maven dependencies on some solutions

I. Introduction

These days thinking about the electricity supplier done before a project to re-do it, when the interview might use this project done before that, presumably not be any problem, and the results dependencies in maven download here stuck, put the problems encountered as well as the following to say about the solution, in case if there is a small partners have encountered this problem, you can be a reference.

Second, the problems encountered

1, the first question

The original project with maven 3.0.5 is the version used is the default download source, resulting in a problem downloading dependencies on IDEA, maven pom.xml file plug-ins and packages can not be downloaded. Thanks to good English, the error read it (the following error), found that last sentence is the key, seems to be required HTTPS, then I found a bit on Google, found a solution on the stack overflow (picture below), turned out to be the latest the default maven central repository has already httpreplaced https, and then I replaced it maven, with the latest version 3.6.3, the result has yet another problem later.

Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.5/maven-resources-plugin-2.5.pom. Return code is: 501 , ReasonPhrase:HTTPS Required.

Here Insert Picture Description

2, the second question

I thought the version of a maven should change nothing on the issue, by the way Ali has become the mirror with clouds mirror, thinking can download faster, and found still can not download dependencies, and it was not not been downloaded, it is species can sometimes lower, sometimes the problem can not be downloaded, I rely on when I feel that sometimes the devil is simply no problem, and then from the afternoon found the night, in the middle always thought the problem may be mirrored Ali, and has been change mirroring, change the configuration file, and finally did not solve the problem, when the night still think it is not too high IDEA version, or is there a problem Maven version. The next day, I looked good error (following error), it is found to have a basic problem, in fact, feel fuss yesterday, and if the errors are a good look, it is estimated earlier resolved. Internet search a bit and found out that access httpsrequires a certificate and my certificate seems wrong. Then is looked at someone else's solution, it seems solved.

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Conclude that certificate problems caused due to an error related operations maven, there are many solutions, I used the most simple and crude one, is to ignore SSL certificate checking. Methods as below:

Direct ignore SSL certificate checking, skip this validation, with the parameters in the command maven package

-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true

Setting the IDEA: settings ==> Build, Execution, Deployment ==> Build Tools ==> Maven ==> Runner the VM Options, fill parameter, shots are as follows:
Here Insert Picture Description

3, reference sites

1、mvn命令报错:unable to find valid certification path to requested target
2、彻底解决unable to find valid certification path to requested target
3、Maven:sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Published 159 original articles · won praise 270 · views 240 000 +

Guess you like

Origin blog.csdn.net/q982151756/article/details/104074943