2013-01-11 30 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