Spring Boot使用Gradle找不到spring-boot-starter-dao-jpa包?

时间:2018-04-21 18:37:28

标签: java spring spring-boot gradle

我有以下Gradle文件:

我的工作正常,但突然之间似乎无法找到这个JPA包。我添加了compile("org.springframework.boot:spring-boot-starter-dao-jpa")

每当我尝试构建时,它就会抱怨这一点。我检查了依赖图,它有一个红色下划线表示它已丢失。我能做什么?

buildscript {
    ext {
        springBootVersion = '2.0.1.RELEASE'
    }

    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
    }
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'maven'

group = 'com.remindful'
version = '1.0.0-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-jersey')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.springframework.boot:spring-boot-starter-web-services')
    compile('org.springframework.boot:spring-boot-starter-websocket')
    compile('org.springframework.session:spring-session-core')
    compile("org.springframework.boot:spring-boot-starter-dao-jpa")
    compile("com.h2database:h2:1.4.191")
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    compile group: 'com.google.guava', name: 'guava', version: '11.0.2'
    compile group: 'com.h2database', name: 'h2', version: '1.4.197'
    testCompile 'junit:junit:4.12'
    testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: '2.0.1.RELEASE'
}

// To force debug on application boot, switch suspend to y
bootRun {
    systemProperties System.properties
    jvmArgs=["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"]
}

2 个答案:

答案 0 :(得分:0)

看起来当我重构我的项目结构时,intellij变得聪明并重命名了依赖项。小心那个!

答案 1 :(得分:0)

Spring Maven Repository中没有spring-boot-starter-dao-jpa的迹象,所以我怀疑它不存在。尝试删除该行。

也许这是副本&从以下两行的spring-boot-starter-data-jpa依赖关系中粘贴错误......?