【问题标题】:Spring Boot dependency not found by GradleGradle 未找到 Spring Boot 依赖项
【发布时间】:2020-03-31 14:26:09
【问题描述】:

这是我的 build.gradle 文件

    plugins {
    id 'org.springframework.boot' version '2.2.1.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
}

group = 'de.quinscape'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations {
    developmentOnly
    runtimeClasspath {
        extendsFrom developmentOnly
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-mail'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-context'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    compile("org.springframework.security:spring-security-ldap")
    compile group: 'com.h2database', name: 'h2', version: '1.4.197'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}

test {
    useJUnitPlatform()
}

这是我得到的错误:

Could not find org.springframework.boot:spring-context:.

我做错了什么?我使用 Spring Initializer 添加了所有依赖项。而且我只在该特定项目中遇到此错误。

【问题讨论】:

  • AFAIK,org.springframework.boot:spring-context 不存在,而 org.springframework:spring-context 存在
  • 你需要 org.springframework.boot:spring-context' 做什么?

标签: spring-boot gradle


【解决方案1】:

只需删除implementation 'org.springframework.boot:spring-context',spring 上下文将自动可用(带有间接依赖关系)

【讨论】:

    猜你喜欢
    • 2020-11-11
    • 2018-01-10
    • 1970-01-01
    • 2016-09-17
    • 2021-07-24
    • 2016-02-10
    • 2020-10-08
    • 1970-01-01
    • 2015-09-16
    相关资源
    最近更新 更多