2013-01-11 44 views
0

我想搭建Buildr,想用它來做一個使用Alfresco的項目。 Alfresco項目正在維護一個Maven倉庫: https://artifacts.alfresco.com使用SSL證書與Buildr訪問Maven存儲庫?

正如你所看到的,它使用的是https。

我試圖通過聲明下載2瓶+依賴的類路徑:

ALFRESCO_CORE= transitive('org.alfresco:alfresco-core:jar:4.2.b')

ALFRESCO_REPOSITORY= transitive('org.alfresco:alfresco-repository:jar:4.2.b')

構建文件失敗,出現以下錯誤信息:

Requesting https://artifacts.alfresco.com/org/alfresco/alfresco-core/4.2.b/alfresco-core-4.2.b.pom warning: peer certificate won't be verified in this SSL session Buildr aborted! RuntimeError : Failed to download org.alfresco:alfresco-core:pom:4.2.b, tried the following repositories: http://repo1.maven.org/maven2/ https://artifacts.alfresco.com/

我相信,這是由於構建這個事實r不信任maven倉庫證書?

我該如何讓它接受證書?或者,跳過證書驗證?

目前,它是我無法訪問資源庫:(

我希望有人能給出提示如何進行的一大攪局者! 阿加塔

回答

1

warning: peer certificate won't be verified in this SSL session

消息的這部分表明,紅寶石不會試圖驗證證書,所以我不認爲這是一個SSL問題。

看起來確實是有沒有神器在錯誤信息的網址:

$ curl -v -IHEAD https://artifacts.alfresco.com/org/alfresco/alfresco-core/4.2.b/alfresco-core-4.2.b.pom 
[...] 
> HEAD /org/alfresco/alfresco-core/4.2.b/alfresco-core-4.2.b.pom HTTP/1.1 
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5 
> Host: artifacts.alfresco.com 
> Accept: */* 
> 
< HTTP/1.1 404 Not Found 

這表明無論是與工件名稱或與存儲庫的問題。彼得的工作示例使用存儲庫https://artifacts.alfresco.com/nexus/content/groups/public/。從錯誤消息的URL看起來,您使用的是https://artifacts.alfresco.com/。你可以試試Peter的倉庫URL嗎?

2

我無法重現此問題廣告在從這裏至少SSL證書似乎是有效的,我用來測試這個構建文件是;

repositories.remote << 'https://artifacts.alfresco.com/nexus/content/groups/public/' 
repositories.remote << 'https://artifacts.alfresco.com/nexus/content/groups/public-snapshots/' 
repositories.remote << 'http://repo1.maven.org/maven2' 

project 'foo' do 
    project.group = 'x' 
    project.version = 'x' 
    compile.with transitive('org.alfresco:alfresco-core:jar:4.2.b') 
end 

但是,如果SSL證書是無效的,你不關心你應該能夠猴補丁buildr類通過將文件添加任務/ ssl_fix.rake,內容如下

module URI 
    class HTTP 
    def connect 
     if proxy = proxy_uri 
     proxy = URI.parse(proxy) if String === proxy 
     http = Net::HTTP.new(host, port, proxy.host, proxy.port, proxy.user, proxy.password) 
     else 
     http = Net::HTTP.new(host, port) 
     end 
     if self.instance_of? URI::HTTPS 
     require 'net/https' 
     # Patch so verifying is not a problem 
     http.verify_mode = OpenSSL::SSL::VERIFY_NONE 
     http.use_ssl = true 
     end 
     yield http 
    end 
    end 
end 

HTH