Issue
ANY IDEAS?? I downloaded a Maven project for IntelliJ and cannot build it. I get errors for dependencies and plugins:
(SOLVED: THIS was because I was trying to run it on my work laptop in work, and the company firewall was blocking me from downloading from the public Maven repository. Thank you)
Solution
From reviewing the log files, its as people have mentioned IntelliJ is not able to actually download the dependencies.
The reason why is:
Caused by: java.lang.RuntimeException:
org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.springframework:spring-aop:pom:4.1.2.RELEASE 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
This typically can occur when all your external traffic is being routed by a corporate proxy that is performing a man-in-the-middle type of scan where the traffic is decrypted, scanned and then re-encrypted.
We experience the same thing in our office so our solution was:
- Install your own version of the java SDK (Ex. using SDKMan)
- In your new install import into the default trust store the certificates required to validate the new certificate chain
- Helps to access the URL in Chrome to view the certificate chain)
- If it doesn't look like the Screenshot then there is a proxy
- Update IntelliJ so the
Project SDK
is the new one - Update IntelliJ so
JDK for importer
is the new one - Click the
Reimport All Maven Projects
in IntelliJ
This should allow it to continue to work without problems, alternatively in IntelliJ you can run the adhoc maven goal of:
mvn clean install -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true
And it should install all the required dependencies into the local maven cache by ignoring all the SSL certificate problems however this is generally a bad idea.
At this point you can then click the Reimport All Maven Projects
in IntelliJ to have it refresh but I found this always doesn't work as IntelliJ sometimes downloads additional plugin dependencies that it can get hung up on that are outside of the clean install
goals.
Answered By - Welsh
Answer Checked By - Mary Flores (JavaFixing Volunteer)