Maven-publish to https, gradle 2.14.1, java 1.8.0_102 Mac OS X, cert path problems

plugins

(Steve Storck) #1

Hello. When I try to publish via the maven-publish plugin, configured like:

publishing {
    repositories {
        maven {
            authentication {
                basic(BasicAuthentication)
            }
            credentials {
                username = 'user'
                password = 'pass'
            }
            url 'https://nexus.myserver.com:8443/repository/maven-snapshots/'
        }
    }
    publications {
        mavenJava(MavenPublication) {
            from components.java
        }
    }
}

I get the following error:

Could not GET 'https://nexus.myserver.com:8443/repository/maven-snapshots/com/example/1.0.0-SNAPSHOT/maven-metadata.xml'.
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

I am using a cert that is valid and signed by godaddy. It works fine in my browser, and I can curl from the command line and it’s fine also. What do I need to do in order to get gradle to accept the valid and signed cert?

Edit: I had the same result on CentOS with a similar configuration otherwise. Can gradle simply not handle deploying to an https url?


(Chris Doré) #2

Sounds like the trust store of your JDK does not contain the root certs of your Nexus server. However, as a check, are you able to resolve dependencies from the server or does that also fail with the same error?

$JAVA_HOME/jre/lib/security/cacerts may need to be updated. I’m no expert on this stuff, I’m just throwing out ideas based on some googling.
EDIT: Mac trust store might be somewhere else, I’m not sure.