Peer not authenticated while importing Gradle project in eclipse
Solution 1
NOTE: Please ensure the server is trustworthy before you follow these steps.
If you get any other error like this:
Could not GET 'https://some_server.com/some/path/some.pom'.
> peer not authenticated
Then you need to import a certificate :
- open the 'https://some_server.com/some/path/some.pom' in your favorite browser
- export the cert using the Steps to export cert from a web site
- copy the cer into
JDK_HOME/jre/lib/security
folder - open a shell and go to
JDK_HOME/jre/lib/security
folder - then import the cer into java using the
keytool -import -alias <the short name of the server> -file <cert_file_name_you_exported.cer> -keystore cacerts -storepass changeit
It will prompt you to import the certificate, type yes and press enter.
Then restart your eclipse and try building the project.
Solution 2
ANSWER#2:Providing the correct fix after two Negative markings
Make this changes to the top-level build.gradle file.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
//jcenter()
jcenter {
url "http://jcenter.bintray.com/" <=THIS IS THE LINE THAT MAKES THE DIFFERENCE
}
}
}
allprojects {
repositories {
//jcenter()
jcenter {
url "http://jcenter.bintray.com/" <=THIS IS THE LINE THAT MAKES THE DIFFERENCE
}
}
}
ANSWER#1 (Although this is not accepted would like to keep this)
If you see "peer not authenticated errors , it does not necessarily mean that the application does not hold a valid certificate. It also could mean that connections are being reset by the firewall, load balancer, or web servers. Try (re)starting the application with the Administator
privilege.
On Windows:
- Ensure you have administrator privileges.
- Right Click application icon -> Select "Run as Administrator"
On Linux:
- Ensure you have root access.
- type
sudo "app execution script name"
Solution 3
Change your repositories to the following in the build.gradle
repositories {
maven {
url "http://repo1.maven.org/maven2"
}
}
Solution 4
After importing the certificate as suggested in the above answer, edit your gradle.properties file and insert the following lines (having in mind your proxy settings):
HTTPS:
systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
HTTP:
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
Solution 5
Upgrading from java7 to java8 did the trick for me.

Comments
-
MrTambourineMan 5 months
While I am importing gradle project in eclipse, it is giving me this error.
FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'test'. > Could not resolve all dependencies for configuration ':classpath'. > Could not resolve de.richsource.gradle.plugins:gwt-gradle-plugin:0.3. Required by: :test:unspecified > Could not GET 'https://github.com/steffenschaefer/gwt-gradle-plugin/raw/maven-repo/de/richsource/gradle/plugins/gwt-gradle-plugin/0.3/gwt-gradle-plugin-0.3.pom'. > peer not authenticated * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I am using internet via proxy connection. If that is the issue, where to specify the proxy settings inside eclipse. In General-->Network connections, proxy settings are already there
Please help.
-
MrTambourineMan over 8 yearsDone that. Its still giving the same error. Imported the certificates :(
-
MrTambourineMan over 8 yearsyes. build path is ok. There were two certificates to import right?
-
dev2d over 8 yearssee, if your buildpath is having referance to JRE you have to import cert to JRE/lib/security/cacerts
-
dev2d over 8 yearsalso i think only one cert file you exported needed to be imported in cacerts
-
MrTambourineMan over 8 yearsyes added it to cacerts. Build path is having reference to JRE. Still same issue
-
dev2d over 8 yearscan you please check if this can help u tools.android.com/tech-docs/new-build-system/…
-
dev2d over 8 yearssee in all what you need to identify is, what keystore is your eclipse referring at the time of import! if it is gradle specific keystore, you need to import the cert in that keystore. because this is just a communication error between your system and GIT server.
-
userv about 8 yearsSame problem but this is not working for me. check this link where logs and more details regarding the problem is mentioned : groups.google.com/forum/#!topic/adt-dev/C3qWxrS1xrY
-
MFIhsan over 7 yearsThank you so much. It was so complex to figure out this thing especially when gradle was giving weird error.
-
Alexander Prokofyev about 7 yearsThank you! Thought I should change "changeit" password to something more secure. :)
-
Nabdreas about 7 years@VD' Hats off mate, fixed my problem! Thanks a lot!
-
dev2d almost 7 yearsit can be anything, if server host is represented as www.google.com, you can provide alias as google, it does not matter as soon as certificate is valid but if you want to list all imported/trusted certs, you can quickly understand that the cert entry with alias "google" represents google.com's cert
-
Cozzbie almost 7 yearsOk thanks. Tried the said solution and build still fails in my case. Using Ionic and trying to build from the CLI.
-
aliteralmind almost 7 yearsOn OSX. Had to
sudo keytool ...
. -
RaGe almost 7 yearsThe fact that they're getting 'Peer not authenticated' error means that they are already able to reach the repo server, either directly, or they already configured the proxy settings.
-
RaGe almost 7 yearsHow does running as admin/sudo on a machine give you elevated privileges on a remote web-server or load balancer?
-
Devendra Vaja almost 7 yearsIt does not give privileges on the remote server. You should read the HTTPS authentication process where the certificate comes into the picture. The access to certification storage location may be accessible only using admin rights and thus the remote server could not validate the client. I hope it is clear now.
-
abudaan over 6 yearsI had the same issue. After importing the certificate from jcenter.bintray.com all .pom files could be downloaded. However I got the "peer not authenticated" error again as soon as the script started downloading the .jar files. But that was fixed after I had edited the build.gradle file as described above.
-
Donal Rafferty over 6 yearsThis worked for me, I was getting the peer not auth error and noticed I had the http proxy set but not the https one set, setting the https proxy to be the same as the http one resolved the issue.
-
subjectivist over 6 yearsThis answer got me going! Thanks. But I would like to know, instead of editing the build.gradle for each of my projects, where does the default gradle information reside for gradle() ? Thanks
-
subjectivist over 6 yearsSee stackoverflow.com/questions/37284472/… . Hopefully it gets an answer.
-
Scott Jungwirth over 6 yearsGoing through the steps I realized I had CharlesProxy on, disabling it fixed the issue.
-
subjectivist over 6 yearsI placed vbscript at the following SO question to fix this issue in new projects: stackoverflow.com/questions/37284472/…
-
MarcFasel over 2 yearsSeems like http is not allowed for maven repo anymore. I get a 501 error: HTTPS Required
-
MarcFasel over 2 yearsSeems like http is not allowed in JCenter anymore. I get a 403: Forbidden error