При использовании gradle в springboot зависимость загрузки обнаружила sun.security.validator.validatorexception. Я не знаю как это решить - PullRequest
0 голосов
/ 03 мая 2020

Я использую gradle для создания проекта springboot, но зависимость загрузки gradle всегда не очень хорошая. Ошибка выглядит следующим образом:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'server'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.2.2.RELEASE.
     Required by:
         project :
      > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.2.2.RELEASE.
         > Could not get resource 'http://maven.aliyun.com/nexus/content/groups/public/org/springframework/boot/spring-boot-gradle-plugin/2.2.2.RELEASE/spring-boot-gradle-plugin-2.2.2.RELEASE.pom'.
            > Could not GET 'https://maven.aliyun.com/nexus/content/groups/public/org/springframework/boot/spring-boot-gradle-plugin/2.2.2.RELEASE/spring-boot-gradle-plugin-2.2.2.RELEASE.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Я пытался добавить соответствующий сертификат в библиотеку сертификатов Java, но это было бесполезно. Я могу скачать его прямо в браузере, но не могу использовать gradle для добавления зависимости. Я надеюсь, что смогу получить помощь, спасибо.

Моя конфигурация следующая:

buildscript {
    ext {
        springBootVersion = '2.2.2.RELEASE'
    }
    repositories {
        maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group = 'com.cqut.spider'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'}
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web' 
    implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.0'
    testImplementation 'org.springframework.boot:spring-boot-starter-test' 
    implementation 'com.squareup.okhttp3:okhttp:3.12.1'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation  group: 'mysql', name: 'mysql-connector-java', version: '8.0.15'
    implementation 'com.github.pagehelper:pagehelper-spring-boot-starter:1.2.5'

    runtimeOnly('mysql:mysql-connector-java')
    compile 'tk.mybatis:mapper-spring-boot-starter:1.1.5'
    compile "net.sf.json-lib:json-lib:2.4:jdk15"

}

1 Ответ

0 голосов
/ 03 мая 2020

Если вы go перейдете на maven.aliyun.com с http, вы будете перенаправлены на https, что хорошо, и то, что в настоящее время делает подавляющее большинство репозиториев. Ваш файл сборки все еще имеет репозиторий http, вам нужно изменить его на https, и я предполагаю, что ошибка исчезнет go.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...