1

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)

VIEW BUILD LOG HERE

VIEW IDEA LOG HERE

MAven

Spaceman
  • 51
  • 1
  • 7
  • See https://stackoverflow.com/a/42427510/104891. At least the logs are needed to investigate further. – CrazyCoder Nov 13 '19 at 17:44
  • @CrazyCoder Thank you. Logs added. – Spaceman Nov 13 '19 at 22:24
  • The build log doesn't help, attach idea.log or all the logs instead. Help | Compress Logs and Show in ... – CrazyCoder Nov 13 '19 at 22:37
  • @CrazyCoder- Done. Thanks again! – Spaceman Nov 13 '19 at 23:54
  • It looks like some connection issue, Maven is not able to download the dependencies from the repository. Make sure Internet connection is available and your antivirus/firewall is not blocking the downloads. Try running `mvn clean package` in the command line to ensure that it completes without any errors. – CrazyCoder Nov 14 '19 at 00:49
  • He might also need configure connectino via a proxy, and to check his `settings.xml` is correct – vikingsteve Nov 14 '19 at 11:43

1 Answers1

5

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.

Welsh
  • 5,138
  • 3
  • 29
  • 43
  • 1
    You were right... It 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. – Spaceman Dec 03 '19 at 22:33