0

我想试用一下 Buildr,并想将它用于使用 Alfresco 的项目。Alfresco 项目正在维护一个 Maven 存储库: https ://artifacts.alfresco.com

如您所见,它使用的是https。

我尝试通过声明将 2 个 jars + 依赖项下载到类路径:

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/

我相信,这是因为建造者不信任 Maven 存储库证书?

我怎样才能让它接受证书?或者,跳过证书验证?

目前,我无法访问存储库是一个主要的阻碍:(

我希望有人可以提示如何进行!阿加塔

4

2 回答 2

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 证书无效并且您不在乎,您应该能够通过添加具有以下内容的文件 tasks/ssl_fix.rake 来修改 buildr 类

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

高温高压

于 2013-01-11T23:52:23.443 回答
1

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

这部分消息表明 ruby​​ 不会尝试验证证书,所以我认为这不是 SSL 问题。

看来错误消息中的 URL 确实没有工件:

$ 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

这表明工件名称或存储库存在问题。Peter 的工作示例使用存储库https://artifacts.alfresco.com/nexus/content/groups/public/。从错误消息的 URL 看来,您正在使用https://artifacts.alfresco.com/. 你可以试试彼得的存储库 URL 吗?

于 2013-01-16T00:14:47.507 回答