Gradle:unable to find valid certification path to requested target

最近使用Gradle 構建項目

使用SpringBoot 打包插件,出現如下異常:

Could not HEAD 'https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/2.0.4.RELEASE/spring-boot-gradle-plugin-2.0.4.RELEASE.pom'.

unable to find valid certification path to requested target

gradle 腳本:

buildscript {
    dependencies {
        // 輔助springboot 打包
        classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE"
    }
}

在網上找了很多辦法,都是添加證書,但是本人添加了幾次證書,都沒法解決這個問題。

1個小時過去了。。。最終,找到個解決的笨辦法(笑哭。。。)。

解決辦法如下:

1、通過maven下載插件到本地:

<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-gradle-plugin</artifactId>
        <version>2.0.4.RELEASE</version>
      </dependency>

2、修改gradle 構建腳本

buildscript {
    repositories {
        // maven 本地倉庫
        mavenLocal()
        // 添加 Maven 倉庫
        maven {
            url 'https://maven.aliyun.com/nexus/content/groups/htm'
        }
        mavenCentral()
    }

    dependencies {
        // 輔助springboot 打包
        classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE"
    }
}

從本地Maven 庫獲取插件jar。 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章