Maven Could not resolve dependencies for project… Could not transfer artifact… sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertP athBuilderException: unable to find valid certification path to requested target
or in short: unable to find valid certification path to requested target maven", maven" unable to find valid certification path to requested target
Table of Contents
Maven Could not resolve dependencies …
maven" is trying to connect to artifacts repository using https, but you don’t have valid ssl" certificates.
To resolve this, you have a few options, but I will only show you how to make the 1. point
- Request that maven" accept the unsigned certificate anyhow.
- Make sure that the Java-based Maven trust store has the public certificate for the Nexus" server.
- Have a root certificate authority like Verisign sign the certificate on Nexus.
Let’s use maven" option like below to allow maven" use insecure connection. Additionally I added -U option to enforce downloading of artifacts. The example use compile goal but of course you can use another variation like install, package, deploy and etc.
mvn clean compile -U -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true
It looks like you are encountering a problem with maven" when trying to build your project. The error message “Could not resolve dependencies for project” suggests that maven" is unable to find or download the dependencies that your project depends on. The specific error “Could not transfer artifact” followed by “sun.security.validator.ValidatorException: PKIX path building failed” indicates that there may be a problem with the ssl" certificate of the remote repository that maven" is trying to access.
There are a few potential causes for this issue:
- The remote repository may be using an ssl" certificate that is not trusted by the JVM. In this case, you may need to import the certificate into the JVM’s truststore.
- The remote repository may be using a self-signed certificate. In this case, you may need to disable certificate validation by adding the following to your
<mirrors> <mirror> <id>mymirror</id> <url>http://central</url> <mirrorOf>central</mirrorOf> <uniqueId>12345</uniqueId> <ssl> <certificateCheck>false</certificateCheck> </ssl> </mirror> </mirrors>
- The remote repository may be offline" or experiencing connectivity issues. In this case, you may need to wait for the repository to come back online or try again later.
- There may be a problem with your network configuration or proxy settings. Make sure that you are able to access the remote repository from your machine and that there are no connectivity issues.
If none of these suggestions help, it may be helpful to examine the maven" debug output (which can be enabled by adding the
-X flag to your maven" command) to get more information about the specific cause of the error.
What Is Maven?
maven", a Yiddish word meaning accumulator of knowledge, began as an attempt to simplify the build processes in the Jakarta Turbine project. There were several projects, each with their own Ant build files, that were all slightly different. JARs were checked into CVS. We wanted a standard way to build the projects, a clear definition of what the project consisted of, an easy way to publish project information, and a way to share JARs across several projects.
The result is a tool that can now be used for building and managing any Java-based project. We hope that we have created something that will make the day-to-day work of Java" developers easier and generally help with the comprehension of any Java-based project.https://maven.apache.org/what-is-maven.html
What Is SSL?
A security mechanism for the Internet based on encryption is known as ssl", or Secure Sockets Layer. To provide privacy, authentication, and data integrity in Internet conversations, Netscape created it for the first time in 1995. The present TLS encryption now in use predates ssl".
The URL of a website that uses SSL/TLS begins with “HTTPS” rather than “HTTP.”
Could You Please Share This Post? I appreciate It And Thank YOU! :) Have A Nice Day!
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?