Gradle Build找不到依赖项

亚伦沙巴尼安

我一直在为 Springboot 使用 gradle,它曾经很好,但突然之间 gradle 构建停止工作。我不断收到错误消息,说找不到依赖项。

这是gradle代码:

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。

有任何想法吗?

马里奥洛博伊

您的Maven存储库是错误的。

改变

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

repositories {
    mavenCentral()
}

请参阅此处有关如何文件中声明Maven存储库的良好解释build.gradle

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章