javagradlejava-8android-gradle-pluginjava-11

How to resolve gradle tls connection after upgrading from 5.4 to 6.8.3?


I upgrade the projects Gradle version from 5.4.1 to 6.8.3 and have changed the custom repository to https.

I had a similar issue with maven but after mirroring has been solved. I can build the project without anyproblem with gradle 5.4.1 but when I upgrade the gradle to 6.8.3 then I got the following error:

        The server may not support the client's requested TLS protocol versions: (TLSv1.2). You may need to configure the client to allow other protocols to be used.
     See: https://docs.gradle.org/6.8.3/userguide/build_environment.html#gradle_system_properties
                          > sun.security.validator.ValidatorException: 
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Solution

  • PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

    You get this message when the JRE is missing a certificate. I think you are going to have to install your company's certificate in the docker image's JRE

    Your Dockerfile will need to do something like:

    FROM adoptopenjdk/openjdk11:jre-11.0.11_9-alpine
    
    // my-company.crt is your company's certificate
    COPY my-company.crt my-company.crt
    
    RUN keytool -cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias my-alias -file my-company.crt