【问题标题】:Adding Spring Security to Gradle project breaks Spring Data JPA?将 Spring Security 添加到 Gradle 项目会破坏 Spring Data JPA?
【发布时间】:2018-09-27 15:36:02
【问题描述】:

我正在尝试将 Spring Security 添加到我的项目中,但是在将其添加到我的 gradle 文件并导入更改后,突然 Spring Data JPA 依赖项不再起作用。

dependencies {
    compile('org.springframework.boot:spring-boot-starter-repository-jpa')
    compile("org.springframework.boot:spring-boot-starter-security")
    compile('org.springframework.boot:spring-boot-starter-web')
    runtime('com.h2database:h2')
    runtime('mysql:mysql-connector-java')
    compileOnly('org.projectlombok:lombok')
    testCompile('org.springframework.boot:spring-boot-starter-test')
    testCompile('org.springframework.security:spring-security-test')
}

我得到的错误:

警告:根项目“x”:无法解析 额外的项目配置。 详细信息: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: 无法解析配置 ':compile' 的所有文件。造成的: org.gradle.internal.resolve.ModuleVersionNotFoundException:不能 找到 org.springframework.boot:spring-boot-starter-repository-jpa:。 要求: 项目:

这是什么原因?

【问题讨论】:

    标签: java spring spring-boot gradle


    【解决方案1】:

    不存在org.springframework.boot:spring-boot-starter-repository-jpa 这样的东西。

    应该是org.springframework.boot:spring-boot-starter-data-jpa

    【讨论】:

    • 奇怪,因为应用程序可以正常工作。现在我已经更改了它,我收到“Java:找不到符号”错误。
    • 我在 spring 存储库中找不到 org.springframework.boot:spring-boot-starter-repository-jpa。即使是谷歌搜索也没有带来任何好处。如果您使用 IntelliJ,我会检查本地历史以了解它之前的工作方式。安全依赖有双引号,但没问题。在我的 IDE 中运行良好。
    猜你喜欢
    • 1970-01-01
    • 2018-10-27
    • 2017-03-19
    • 2019-05-23
    • 2021-09-20
    • 2020-10-15
    • 2014-07-02
    • 2018-12-18
    • 1970-01-01
    相关资源
    最近更新 更多