Gradle Android与maven存储库身份验证错误通信

时间:2016-03-29 12:00:39

标签: android maven gradle maven-2

我在gradle构建中有这些,但是当我尝试编译repositories { maven { credentials { username 'admin' password '*********' } url 'https://cloudbuild.livegenic.com/nexus/content/repositories/test_kirill/' } } 时,它会给我Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://cloudbuild.livegenic.com/nexus/content/repositories/test_kirill/com/livegenic/livegenic-core/2.0.0/livegenic-core-2. 0.0.pom'. at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:83) at org.gradle.internal.resource.transport.http.HttpClientHelper.performRawGet(HttpClientHelper.java:69) at org.gradle.internal.resource.transport.http.HttpClientHelper.performGet(HttpClientHelper.java:73) at org.gradle.internal.resource.transport.http.HttpResourceAccessor.openResource(HttpResourceAccessor.java:51) at org.gradle.internal.resource.transport.http.HttpResourceAccessor.openResource(HttpResourceAccessor.java:34) at org.gradle.internal.resource.transfer.DefaultExternalResourceConnector.openResource(DefaultExternalResourceConnector.java:41) at org.gradle.internal.resource.transfer.ProgressLoggingExternalResourceAccessor.openResource(ProgressLoggingExternalResourceAccessor.java:36) at org.gradle.internal.resource.transport.DefaultExternalResourceRepository.getResource(DefaultExternalResourceRepository.java:63) at org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor.getResource(DefaultCacheAwareExternalResourceAccessor.java:75) at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadStaticResource(DefaultExternalResourceArtifactResolver.java:90) ... 133 more Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128) at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:572) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:294) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:640) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:479) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906) at org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:137) at org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:118) at org.gradle.internal.resource.transport.http.HttpClientHelper.performHttpRequest(HttpClientHelper.java:113) at org.gradle.internal.resource.transport.http.HttpClientHelper.executeGetOrHead(HttpClientHelper.java:90) at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:81) ... 142 more

也许我正在使用我的gradle srcipt来验证错误的方式?

var round = 0;

EDITED: 这是错误的痕迹

'id="rqty'+ round+ '"'

1 个答案:

答案 0 :(得分:1)

而不是使用https尝试使用http

repositories {
    maven {
        credentials {
            username 'admin'
            password '*********'
        }
        url 'http://cloudbuild.livegenic.com/nexus/content/repositories/test_kirill/'
    }
}

正如所指出的那样,这违背了https的保护,100%同意。唯一真正的解决方案是让服务器修复它的证书。然而,某些企业防火墙可能会拒绝所有流量,是的。如果您可以访问用于重新签名的证书,那么您可以将证书导入到您的工具链中,如此

$ cd $JAVA_HOME/jre/lib/security
$ mv cacerts cacerts.orig
$ chmod 444 cacerts.orig
$ cp cacerts.orig cacerts
$ chmod 664 cacerts
$ $JAVA_HOME/bin/keytool -keystore cacerts -import -alias MyAlias -file /path/to/myCert.cer

确保以能够修改系统上的Java密钥库的用户身份运行keytool导入。对于我来说,在Mac上是根。