gpt4 book ai didi

spring - 在springboot中使用gradle时,加载依赖项遇到sun.security.validator.validatorexception。我不知道怎么解决

转载 作者:行者123 更新时间:2023-12-03 05:25:18 26 4
gpt4 key购买 nike

我正在使用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,我想错误会消失。

关于spring - 在springboot中使用gradle时,加载依赖项遇到sun.security.validator.validatorexception。我不知道怎么解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61569717/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com