Could Not Transfer Artifact Org.Apache.Maven.Plugins:Maven-Surefire-Plugin:Pom:2.7.1 From/To Central (Http://Repo1.Maven.Org/Maven2)

Maven Errror Could not transfer artifact org.apache.maven.plugins:maven-source-plugin:pom:3.0.1 from/to central

According to the error message:

Transfer failed for https://repo.maven.apache.org/maven2...unable to find valid certification path to requested target

It shows the Maven is trying to download an indirect dependency from Maven Central Repository located at https://repo.maven.apache.org/maven2, which is a secured HTTP server (HTTPS). So the issue may comes from your certificate itself or your network.

For the certificate, try to https://repo.maven.apache.org/maven2 and downloaded the certificate, then added it to the cacerts, with the command:

keytool -import -alias example -keystore  .\cacerts -file example.cer

Please try to check more info from this thread "PKIX path building failed" and "unable to find valid certification path to requested target"

For the network, please try to access that very URL on you browser and check if it's operational. If you really can't access the Maven Central Repo with HTTPS from your browser, maybe it's becouse you are behind some proxy rule that is keeping you from download the server certificate.

You could set the settings.xml file is like below:

 <proxies>
<proxy>
<active>true</active>
<protocol>https</protocol>
<host>MY_COMPANY_HOST</host>
<port>8080</port>
<username>MY_USERNAME</username>
<password>MY_PASSWORD</password>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>MY_COMPANY_HOST</host>
<port>8080</port>
<username>MY_USERNAME</username>
<password>MY_PASSWORD</password>
<nonProxyHosts>localhost</nonProxyHosts>
</proxy>
</proxies>

And check the thread Problems using Maven and SSL behind proxy for some more details.

Could not transfer artifacts from/to central maven repo when using Spring Framework Cloud

I tried the same pom.xml inEclipse IDE and surprisingly it worked there as it is.

To make it work on STS, I added following properties

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<start-class>io.pivotal.microservices.services.Main</start-class>
<spring-cloud.version>Brixton.RELEASE</spring-cloud.version>
</properties>

Refer Unable to download/import package org.springframework.cloud.config.server.EnableConfigServer

This worked for me, though I am still curious about the difference.

Spring-Boot-Maven-Plugin issue "could not transfer"

Sound like you don't have a proxy in your settings.xml. Take a look here for details on how to set it up.

<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>

You should be able to take the proxy details from your browser settings.



Related Topics



Leave a reply



Submit