在eclipse中导入Gradle项目时未经过身份验证。

时间:2023-01-17 13:01:48

While I am importing gradle project in eclipse, it is giving me this error.

当我在eclipse中导入gradle项目时,它给了我这个错误。

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

我正在通过代理连接使用互联网。如果是这个问题,在哪里指定eclipse内的代理设置。一般来说,>网络连接,代理设置已经存在。

Please help.

请帮助。

9 个解决方案

#1


63  

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
  • 在你最喜欢的浏览器中打开“https://some_server.com/some/path/some.pom”。
  • export the cert using the Steps to export cert from a web site
  • 使用从网站导出证书的步骤导出cert。
  • copy the cer into JDK_HOME/jre/lib/security folder
  • 将cer复制到JDK_HOME/jre/lib/安全文件夹。
  • open a shell and go to JDK_HOME/jre/lib/security folder
  • 打开shell并访问JDK_HOME/jre/lib/安全文件夹。
  • then import the cer into java using the
  • 然后使用该方法将cer导入java。
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.

它将提示您导入证书,输入yes并按enter。

Then restart your eclipse and try building the project.

然后重启eclipse并尝试构建项目。

#2


14  

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

回答#2:在两个负标记后提供正确的修复。

Make this changes to the top-level build.gradle file.

对顶层构建进行此更改。gradle文件。

// 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)

回答#1(尽管这是不被接受的,想要保留这个)

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.

如果您看到“peer not authenticated errors”,它并不一定意味着应用程序不持有有效的证书。它还意味着,防火墙、负载平衡器或web服务器正在重置连接。尝试使用管理员权限启动应用程序。

On Windows:

在Windows上:

  • Ensure you have administrator privileges.
  • 确保拥有管理员权限。
  • Right Click application icon -> Select "Run as Administrator"
  • 右击应用程序图标->选择“作为管理员运行”

On Linux:

在Linux上:

  • Ensure you have root access.
  • 确保有根访问。
  • type sudo "app execution script name"
  • 类型sudo“应用程序执行脚本名称”

#3


9  

Change your repositories to the following in the build.gradle

将您的存储库更改为build.gradle中的以下内容。

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

#4


6  

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):

在导入上述答案所建议的证书后,编辑您的gradle。属性文件并插入以下行(请记住您的代理设置):

HTTPS:

HTTPS:

systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080

HTTP:

HTTP:

systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080

#5


2  

Upgrading from java7 to java8 did the trick for me.

从java7升级到java8对我有帮助。

#6


1  

I try to modify the repositories and import the cer to java, but both failed, then I upgrade my jdk version from 1.8.0_66 to 1.8.0_74, gradle build success.

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

#7


0  

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

我正在使用android studio 1.51和Linux (Ubuntu 14.04 LTS),并得到了相同的错误信息:

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.

我尝试移动maven {url "https://jitpack。将它设置为http而不是https,激活“自动接受非信任证书”,手动添加ssl证书…但是仍然没有运气。

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

解决方案是从OpenJDK 7到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. 下载了来自Oracle的JDK文件,我使用了tarball (JDK -8u101-linux-x64.tar.gz) - http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html。
  3. Extract the files. The folder name is jdk1.8.0_101
  4. 提取文件。文件夹名是jdk1.8.0_101。
  5. 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
  6. 现在切换到目录/opt/ (nautilus hotkey: CTRL+L)并创建一个新的文件夹“Oracle_Java”。也许这就需要root权限,所以诺第留斯号和sudo nautilus就可以了。
  7. 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
  8. 请按照https://wiki.ubuntuusers.de/java/installation/oracle_java/java/java_8/java8 - jdk的指示复制文件夹jdk1.8.0_101到/opt/Oracle_Java:不要忘记将版本占位符替换为您的版本。
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. 如果安装成功,您可以使用命令java -版本在终端进行检查。
  3. 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
  4. 现在回到android studio,打开项目结构窗口,按下热键CTRL+SHIFT+ALT+S,到SDK位置。在这里,您可以设置到JDK的路径,例如/opt/Oracle_Java/jdk1.8.0_101。

在eclipse中导入Gradle项目时未经过身份验证。

That's it! :)

就是这样!:)

#8


0  

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):

我犯了这个错误,这是因为VPN代理问题。我禁用了我的VPN客户端,之后一切正常。我使用这个命令(在Mac上):

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

sudo / opt /思科/ anyconnect / bin / acwebsecagent -disablesvc -websecurity

#9


0  

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

升级到最新版本的gradle为我解决了这个问题。

  1. update distributionUrl in gradle-wrapper.properties to use the latest version.
  2. 更新distributionUrl gradle-wrapper。属性使用最新版本。
  3. update gradleVersion in build.gradle to match that version.
  4. 更新gradleVersion构建。与那个版本匹配。

#1


63  

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
  • 在你最喜欢的浏览器中打开“https://some_server.com/some/path/some.pom”。
  • export the cert using the Steps to export cert from a web site
  • 使用从网站导出证书的步骤导出cert。
  • copy the cer into JDK_HOME/jre/lib/security folder
  • 将cer复制到JDK_HOME/jre/lib/安全文件夹。
  • open a shell and go to JDK_HOME/jre/lib/security folder
  • 打开shell并访问JDK_HOME/jre/lib/安全文件夹。
  • then import the cer into java using the
  • 然后使用该方法将cer导入java。
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.

它将提示您导入证书,输入yes并按enter。

Then restart your eclipse and try building the project.

然后重启eclipse并尝试构建项目。

#2


14  

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

回答#2:在两个负标记后提供正确的修复。

Make this changes to the top-level build.gradle file.

对顶层构建进行此更改。gradle文件。

// 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)

回答#1(尽管这是不被接受的,想要保留这个)

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.

如果您看到“peer not authenticated errors”,它并不一定意味着应用程序不持有有效的证书。它还意味着,防火墙、负载平衡器或web服务器正在重置连接。尝试使用管理员权限启动应用程序。

On Windows:

在Windows上:

  • Ensure you have administrator privileges.
  • 确保拥有管理员权限。
  • Right Click application icon -> Select "Run as Administrator"
  • 右击应用程序图标->选择“作为管理员运行”

On Linux:

在Linux上:

  • Ensure you have root access.
  • 确保有根访问。
  • type sudo "app execution script name"
  • 类型sudo“应用程序执行脚本名称”

#3


9  

Change your repositories to the following in the build.gradle

将您的存储库更改为build.gradle中的以下内容。

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

#4


6  

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):

在导入上述答案所建议的证书后,编辑您的gradle。属性文件并插入以下行(请记住您的代理设置):

HTTPS:

HTTPS:

systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080

HTTP:

HTTP:

systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080

#5


2  

Upgrading from java7 to java8 did the trick for me.

从java7升级到java8对我有帮助。

#6


1  

I try to modify the repositories and import the cer to java, but both failed, then I upgrade my jdk version from 1.8.0_66 to 1.8.0_74, gradle build success.

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

#7


0  

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

我正在使用android studio 1.51和Linux (Ubuntu 14.04 LTS),并得到了相同的错误信息:

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.

我尝试移动maven {url "https://jitpack。将它设置为http而不是https,激活“自动接受非信任证书”,手动添加ssl证书…但是仍然没有运气。

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

解决方案是从OpenJDK 7到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. 下载了来自Oracle的JDK文件,我使用了tarball (JDK -8u101-linux-x64.tar.gz) - http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html。
  3. Extract the files. The folder name is jdk1.8.0_101
  4. 提取文件。文件夹名是jdk1.8.0_101。
  5. 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
  6. 现在切换到目录/opt/ (nautilus hotkey: CTRL+L)并创建一个新的文件夹“Oracle_Java”。也许这就需要root权限,所以诺第留斯号和sudo nautilus就可以了。
  7. 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
  8. 请按照https://wiki.ubuntuusers.de/java/installation/oracle_java/java/java_8/java8 - jdk的指示复制文件夹jdk1.8.0_101到/opt/Oracle_Java:不要忘记将版本占位符替换为您的版本。
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. 如果安装成功,您可以使用命令java -版本在终端进行检查。
  3. 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
  4. 现在回到android studio,打开项目结构窗口,按下热键CTRL+SHIFT+ALT+S,到SDK位置。在这里,您可以设置到JDK的路径,例如/opt/Oracle_Java/jdk1.8.0_101。

在eclipse中导入Gradle项目时未经过身份验证。

That's it! :)

就是这样!:)

#8


0  

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):

我犯了这个错误,这是因为VPN代理问题。我禁用了我的VPN客户端,之后一切正常。我使用这个命令(在Mac上):

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

sudo / opt /思科/ anyconnect / bin / acwebsecagent -disablesvc -websecurity

#9


0  

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

升级到最新版本的gradle为我解决了这个问题。

  1. update distributionUrl in gradle-wrapper.properties to use the latest version.
  2. 更新distributionUrl gradle-wrapper。属性使用最新版本。
  3. update gradleVersion in build.gradle to match that version.
  4. 更新gradleVersion构建。与那个版本匹配。