Question

I wanted to take Buildr for a spin, and wanted to use it for a project that is using Alfresco. The Alfresco projects is maintaining a Maven repository at : https://artifacts.alfresco.com

As you can see, it is using https.

I try to download 2 jars + dependencies to the class path by declaring:

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

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

The buildfile fails with the following error message:

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/

I believe, that this is due to the fact, that buildr doesn't trust the maven repositories certificate?

How can I make it accept the certificate? Alternatively, skip certificate validation?

Currently, it is a major showstopper that I can't access the repository :(

I hope somebody can give a hint how to proceed! Agata

Was it helpful?

Solution 2

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

This part of the message indicates that ruby won't be attempting to verify the certificate, so I don't think this is an SSL issue.

It appears that there is indeed no artifact at the URL in the error message:

$ 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

This suggests either a problem with the artifact name or with the repository. Peter's working example uses the repository https://artifacts.alfresco.com/nexus/content/groups/public/. From the error message's URL, it looks like you are using https://artifacts.alfresco.com/. Can you try Peter's repository URL?

OTHER TIPS

I am unable to reproduce this problem ad at least from here the ssl certificate appears to be valid. The buildfile which I used to test this is;

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

However if the SSL certificate is not valid and you don't care you should be able to monkey patch the buildr class by adding a file tasks/ssl_fix.rake with the following content

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top