2016-03-29 47 views
1

傳達我的這些在我的gradle這個構建,但是當我嘗試編譯compile'com.livegenic:livegenic-core:2.0.0'它給了我Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated 搖籃的Android與Maven倉庫驗證錯誤

也許我用我的gradle這個srcipt驗證錯誤的方式?

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 
+0

通常情況下,如果https不信任它會發生 –

+0

@GabrieleMariotti所以我最好問一個誰做的存儲庫?或者這是我的錯誤,因爲我可以從瀏覽器訪問它? –

回答

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 

確保您運行keytool進口的是誰能夠在修改Java密鑰用戶你的系統。對於我來說,這是一個根本的Mac。

+0

這肯定會起作用,但應該指出,這通常是一個不好的建議。雖然非常適合故障排除,但這不應被視爲一種解決方法。這不幸地擊敗了http * s *的全部重點。作爲一個明智的軟件從業者,最好花一些時間讓https工作,而不是完全繞過它。舉一個愚蠢的比喻,當遇到鑰匙卡在鎖上的問題時,這個解決方案說:「簡單,不要鎖上門,問題就解決了。」 – RaGe

+0

@RaGe是的,我讓我的隊友改變回http並且它可以工作,但我認爲需要https。 他說窗戶上的trus-certificate存在問題... –

+0

@Rage,同意。 OP,如果您想使用https,請參閱我的編輯,但取決於您的公司,如果他們會爲您提供證書,則此解決方案可能無法爲您工作。 – JBirdVegas