2016-05-23 76 views
0

我在嘗試使用搖籃文件上傳到的Nexus如果出現以下錯誤:Sonatype的的Nexus上傳失敗,證書nexus.xyz.corp不匹配證書主題的通用名稱:wiki.xyz.corp

證書不匹配證書主題的通用名稱:wiki.xyz.corp

詳情:

C:\data\Workspaces\httpstest>gradlew uploadArchives 
:compileJava UP-TO-DATE 
:processResources UP-TO-DATE 
:classes UP-TO-DATE 
:jar SKIPPED 
:uploadArchives 
Could not transfer artifact com.xyz:httpstest:jar:1.0.0 from/to remo 
te (https://nexus.xyz.corp/nexus/content/repositories/1st-rel/): Cer 
tificate for <nexus.xyz.corp> doesn't match common name of the certi 
ficate subject: wiki.xyz.corp 
Could not transfer artifact com.xyz:httpstest:pom:1.0.0 from/to remo 
te (https://nexus.xyz.corp/nexus/content/repositories/1st-rel/): Cer 
tificate for <nexus.xyz.corp> doesn't match common name of the certi 
ficate subject: wiki.xyz.corp 
:uploadArchives FAILED 
FAILURE: Build failed with an exception. 
* What went wrong: 
Execution failed for task ':uploadArchives'. 
> Could not publish configuration 'archives' 
    > Failed to deploy artifacts: Could not transfer artifact com.xyz 
:httpstest:jar:1.0.0 from/to remote (https://nexus.xyz.corp/nexus/co 
ntent/repositories/1st-rel/): Certificate for <nexus.xyz.corp> doesn 
't match common name of the certificate subject: wiki.xyz.corp 
* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug 
option to get more log output. 
BUILD FAILED 
Total time: 5.511 secs 

通過HTTPS下載工作正常,但上傳無法解決。 nexus.xyz.corp的證書具有正確的通用名稱,而NOT錯誤消息暗示的不是wiki.xyz.corp。 但是,wiki.xyz.corp是在同一臺服務器上運行的不同站點。

這裏有什麼問題?

回答

0

當使用SNI共享不同的域(wiki.xyz.corp和nexus.xyz.corp)時,會發生這種情況。它至少在版本Gradle 2.5 - Gradle 2.13中出現。原因是Gradle在不支持SNI的版本中使用Maven Wagon Library。在這種情況下,Web服務器將返回一個默認證書。看來,wiki.xyz.corp被定義爲默認證書。

這在Gradle DiscussionGradle Issues中討論。

可能的解決方法:

  • 定義nexus.xyz.corp爲默認證書,但在另一個網站上
  • 替換Maven的旅行車與Maven發佈的問題提防,但是這是目前處於測試階段。見Maven Publish.
  • 嘗試配置您的系統沒有SNI
  • 開始搖籃的方式,主機檢查是禁用的(這是一個安全漏洞!):

gradlew -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true uploadArchives

相關問題