在 springboot 中使用 gradle 时,负载依赖遇到了 sun.security.validator.validatorexception。我不知道如何解决



我正在使用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"
}

如果你使用http访问maven.aliyun.com,你会被重定向到https,这很好,也是目前绝大多数存储库正在做的事情。您的构建文件仍然有一个http存储库,您需要将其更改为https,我想错误会消失。

相关内容

最新更新