简体   繁体   中英

Peer not authenticated while importing Gradle project in eclipse

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 inte.net 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.

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 :

 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.

ANSWER#2:Providing the correct fix after two Negative markings

Make this changes to the top-level 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.

  • Ensure you have administrator privileges.
  • Right Click application icon -> Select "Run as Administrator"

  • Ensure you have root access.
  • type sudo "app execution script name"

Change your repositories to the following in the build.gradle

repositories {
    maven  {
        url "http://repo1.maven.org/maven2"
    }
}

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

从 java7 升级到 java8 对我有用。

I had a strange case where I had to change the order of jcenter and maven to get rid of the error

Not working

allprojects {
repositories {
    jcenter()
    maven {
        url "https://maven.google.com"
    }
    maven { url "https://jitpack.io" }

    }
}

Working

allprojects {
repositories {
    maven {
        url "https://maven.google.com"
    }
    jcenter()
    maven { url "https://jitpack.io" }

    }
}

我尝试修改存储库并将cer导入java,但都失败了,然后我将我的jdk版本从1.8.0_66升级到1.8.0_74,gradle构建成功。

I found that this was failing because of transient network issues with my Artifactory server. Other fixes didn't work for me, but simply retrying the build worked.

I'm using android studio 1.51 with Linux (Ubuntu 14.04 LTS) and got the same error message:

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not resolve com.github.PhilJay:MPAndroidChart:v2.1.6.
     Required by:
         dbtraining-dbtrainingandroidapp-517de26197d8:app:unspecified
      > Could not resolve com.github.PhilJay:MPAndroidChart:v2.1.6.
         > Could not get resource 'https://jitpack.io/com/github/PhilJay/MPAndroidChart/v2.1.6/MPAndroidChart-v2.1.6.pom'.
            > Could not GET 'https://jitpack.io/com/github/PhilJay/MPAndroidChart/v2.1.6/MPAndroidChart-v2.1.6.pom'.
               > peer not authenticated

I tried to move maven { url "https://jitpack.io" } , set it to http instead of https, activated the "accept non-trusted certificates automatically", added the ssl certificate manually ... but still no luck.

The solution was to switch from OpenJDK 7 to Oracle JDK 8:

  1. Downloaded the files for the JDK from Oracle, I took the tarball
    (jdk-8u101-linux-x64.tar.gz) - http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
  2. Extract the files. The folder name is jdk1.8.0_101
  3. Now switch to the directory /opt/ (nautilus hotkey: CTRL+L) and create a new folder "Oracle_Java". Maybe this requires root access, so open nautilus from the terimal with sudo nautilus
  4. Copy the folder jdk1.8.0_101 to /opt/Oracle_Java Follow the instructions from https://wiki.ubuntuusers.de/Java/Installation/Oracle_Java/Java_8/#Java-8-JDK : Do not forget to replace the version placeholder in the path with your version
sudo update-alternatives --install "/usr/bin/java" "java" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/javaws" 1 sudo update-alternatives --install "/usr/bin/jar" "jar" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/jar" 1 sudo update-alternatives --set "java" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/java" sudo update-alternatives --set "javac" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/javac" sudo update-alternatives --set "javaws" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/javaws" sudo update-alternatives --set "jar" "/opt/Oracle_Java/jdk1.8.0_VERSION/bin/jar"
  1. You can check in the terminal with the command java -version if your installation was successful.
  2. Now to back to android studio and open the project structure window by pressing the hotkey CTRL+SHIFT+ALT+S and go to SDK Location . Here you can set the path to JDK, for example /opt/Oracle_Java/jdk1.8.0_101

在 android studio 中更改 JDK 版本/路径

That's it! :)

I had this error and it was happening because of a VPN proxy issue. I disabled my VPN client and everything worked fine after. I used this command (on a Mac):

sudo /opt/cisco/anyconnect/bin/acwebsecagent -disablesvc -websecurity

Upgrading to the latest version of gradle fixed this for me.

  1. update distributionUrl in gradle-wrapper.properties to use the latest version.
  2. update gradleVersion in build.gradle to match that version.

An old one, but since I just had this issue with an install of Eclipse 4.11...

There is apparently an issue with JDK11 which could cause this ( https://github.com/spring-projects/sts4/issues/208#issuecomment-469661129 ). When I reverted back to my existing install of JDK8, I no longer saw the error.

I found a solution that worked for me that add this into your gradle.properties.

Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2
JAVA_TOOL_OPTIONS=-Dhttps.protocols=TLSv1.2
systemProp.http.proxyHost=fodev.org
systemProp.http.proxyPort=8118
systemProp.http.nonProxyHosts=*.jitpack.io, *.maven.org
systemProp.https.proxyHost=fodev.org
systemProp.https.proxyPort=8118
systemProp.https.nonProxyHosts=*.jitpack.io, *.maven.org

Removing .gradle directory fixed this for me. If ur getting this due to a caching issue this will help.

我使用 Java 11 导致了这个问题,改成 Java 8 解决了这个问题,也许你可以检查你的 Java 版本。

As suggested in some answers here, I installed Java 8 and error was gone. Seems like bug is related to Java 11.

I used jEnv to manage java versions.

brew install jenv
brew install --cask adoptopenjdk8
jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
jenv global 1.8

Selected answer didn't help, I just couldn't download said certificate using Safari...

I recently had this same issue on Gitlab pipeline that uses gradle to build.jar.

Failing build configuration:

 gradle-build:
  image: gradle:5.2.1-jdk11-slim
  stage: build
  script:
    - ./gradlew clean
    - ./gradlew bootJar  

It turned out that I was using outdated and not-supported gradle Docker image and after upgrading to gradle:6-jdk11-alpine , build passed

In my case upgrading ca-certificates package that's used by openssl fixed this error.

I could download the erring file successfully using the browser and looking at previous answers on this question made me think of old root CA's at OS level and that actually worked.

Not specific to Ubuntu but leaving following url for reference https://ubuntu.com/server/docs/security-trust-store

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM