首页 > 解决方案 > Grgit:禁用 ssl 验证

问题描述

我正在使用 gradle 插件Grgit在测试执行之前从远程仓库获取 SQL 迁移。

我收到以下错误

Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at org.eclipse.jgit.transport.http.JDKHttpConnection.getResponseCode(JDKHttpConnection.java:85)
    at org.eclipse.jgit.util.HttpSupport.response(HttpSupport.java:205)
    at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:654)
    ... 108 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    ... 111 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    ... 111 more

是否有任何可能的方法来禁用 ssl 验证步骤?据我了解,该插件使用Jgit库。我试图导出GIT_SSL_NO_VERIFY=true,但它似乎不起作用。

另外,这是我的毕业任务

task fetchFlywayMigrations {
    def migrationsDir = 'src/main/resources/fromRemote/migrationsRepo'
    def migrationsRepo = gitRepoSQLMigrations
    println "Migrations repo: $migrationsRepo"
    doFirst {
        delete migrationsDir
        println "${migrationsDir} has been cleaned"
    }
    doLast {
        Grgit.clone(dir: file("$migrationsDir"), uri: "${migrationsRepo}")
        println "New migrations has been downloaded to ${migrationsDir}"
    }
}

标签: gitsslgradlebuild.gradlegradle-plugin

解决方案


推荐阅读