首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gradle没有解决任何依赖关系。

Gradle没有解决任何依赖关系。
EN

Stack Overflow用户
提问于 2020-04-28 09:11:32
回答 1查看 1.6K关注 0票数 0

我有一个Gradle java项目。当我试图导入/打开时,我得到的依赖项无法解决错误。

一开始我试着用IntelliJ,所以我怀疑IntelliJ问题安尝试过Netbeans,但没有运气。在我在CLI上尝试了gradle build命令之后,同样的问题。

代码语言:javascript
复制
* What went wrong:
A problem occurred configuring root project 'cloud-smart-city'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.1.9.RELEASE.
 Required by:
     project :
  > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.1.9.RELEASE.
     > Could not get resource 'https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/2.1.9.RELEASE/spring-boot-gradle-plugin-2.1.9.RELEASE.pom'.
        > Could not GET 'https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/2.1.9.RELEASE/spring-boot-gradle-plugin-2.1.9.RELEASE.pom'.
           > java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
  > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.1.9.RELEASE.
     > Could not get resource 'https://jcenter.bintray.com/org/springframework/boot/spring-boot-gradle-plugin/2.1.9.RELEASE/spring-boot-gradle-plugin-2.1.9.RELEASE.pom'.
        > Could not GET 'https://jcenter.bintray.com/org/springframework/boot/spring-boot-gradle-plugin/2.1.9.RELEASE/spring-boot-gradle-plugin-2.1.9.RELEASE.pom'.
           > java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

下面是给定的build.gradle

代码语言:javascript
复制
buildscript {
    ext {
        springBootVersion = '2.1.9.RELEASE'
        springCloudVersion = 'Greenwich.SR3'
        alibabaSCVersion = '2.2.0.RELEASE'
    }
    repositories {
        mavenLocal()
        maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
        maven { url "http://repo.spring.io/snapshot" }
        maven { url "http://repo.spring.io/milestone" }
        jcenter()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

allprojects {
    repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        jcenter()
        mavenCentral()
    }
    tasks.withType(JavaCompile) {
        options.encoding = "UTF-8"
    }
}

subprojects {
    apply plugin: 'java'
    apply plugin: 'idea'
    apply plugin: 'io.spring.dependency-management'

    sourceCompatibility = 1.8
    targetCompatibility = 1.8

    dependencies {
        annotationProcessor('org.projectlombok:lombok:1.18.8')
        implementation("org.projectlombok:lombok:1.18.8")
        implementation("com.google.guava:guava:20.0")
        implementation('com.alibaba:fastjson:1.2.60')
    }

    dependencyManagement {
        imports {
            mavenBom "com.alibaba.cloud:spring-cloud-alibaba-dependencies:${alibabaSCVersion}"
            mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
        }
    }
}

我试过使用Gradle版本的5.2.1, 6.0 and 6.3

该项目有多个子模块。

这是在建造其他的机器。所以我觉得这和我的格斗有关。

我使用Windows 10作为构建系统。

提前感谢

EN

回答 1

Stack Overflow用户

发布于 2022-04-18 06:17:01

在build.gradle文件中检查maven url是否正确。可以使用多个存储库来解决依赖关系。

代码语言:javascript
复制
repositories {
    mavenCentral()
    maven {
        url "https://plugins.gradle.org/m2/"
    }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61476578

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档