首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gradle构建找不到依赖项

Gradle构建找不到依赖项
EN

Stack Overflow用户
提问于 2021-08-03 16:03:50
回答 1查看 460关注 0票数 0

我一直在为Springboot使用gradle,它曾经很好,但是突然之间,gradle的构建就停止了。我不断地收到错误,说无法找到依赖项。

下面是分级代码:

代码语言:javascript
复制
plugins {
    id 'org.springframework.boot' version '2.4.1'
    id 'io.spring.dependency-management' version '1.0.10.RELEASE'
    id 'java'
}

version = '0.0.1'
sourceCompatibility = '1.8'

repositories {
    maven {
        url 'https://repo1.maven.org/'
    }
}

springBoot {
    buildInfo()
}

ext {
    set('springCloudServicesVersion', "2.4.1")
    set('springCloudVersion', "2020.0.3")
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-jdbc'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'io.pivotal.spring.cloud:spring-cloud-services-starter-config-client'
    compileOnly 'org.projectlombok:lombok'
    runtimeOnly 'com.h2database:h2'
    runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
    implementation 'org.springframework.boot:spring-boot-starter-integration'
    testImplementation('org.springframework.boot:spring-boot-starter-test')
    testImplementation 'org.springframework.integration:spring-integration-test'
    implementation 'org.springframework.integration:spring-integration-mail:5.5.1'
    implementation group: 'javax.mail', name: 'mail', version: '1.5.0-b01'
    implementation group: 'org.apache.velocity.tools', name: 'velocity-tools-generic', version: '3.0'
    implementation 'org.jsoup:jsoup:1.14.1'
    implementation 'com.microsoft.sqlserver:mssql-jdbc:7.4.1.jre8'

}

dependencyManagement {
    imports {
        mavenBom "io.pivotal.spring.cloud:spring-cloud-services-dependencies:${springCloudServicesVersion}"
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

test {
    useJUnitPlatform()
}

我所犯的错误:

无法解决org.springframework.boot:spring-boot-dependencies:2.4.1.无法解决io.pivotal.spring.cloud:spring-cloud-services-dependencies:2.4.1.无法解决org.springframework.cloud:spring-cloud-dependencies:2020.0.3.

有什么想法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-08-03 16:16:28

您的maven存储库是错误的。

变化

代码语言:javascript
复制
repositories {
    maven {
        url 'https://repo1.maven.org/'
    }
}

代码语言:javascript
复制
repositories {
    mavenCentral()
}

请参阅here关于如何在build.gradle文件中声明maven存储库的很好的说明。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68639367

复制
相关文章

相似问题

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