包 org.springframework.data.repository 不存在 spring boot jpa

2024-03-07

我对 spring boot + jpa 有一个小问题。我已将依赖项添加到 POM.xml,我可以从 spring 工具套件正常运行它(作为 spring boot 应用程序运行)。但是当我从命令行“mvn spring-boot:run”运行时,它会抛出错误。

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building THA 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:1.5.2.RELEASE:run (default-cli) > test-compile @ THA >>>
[WARNING] The POM for org.springframework:spring-jdbc:jar:4.3.7.RELEASE is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.jboss:jandex:jar:2.0.0.Final is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.springframework.data:spring-data-jpa:jar:1.11.1.RELEASE is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ THA ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ THA ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to D:\RondoWare\Programming\SpringBoot\workspace_3.8.3\THA\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/RondoWare/Programming/SpringBoot/workspace_3.8.3/THA/src/main/java/com/rondox/sb/th/repository/ProductTypesRepository.java:[3,43] package org.springframework.data.repository does not exist
[ERROR] /D:/RondoWare/Programming/SpringBoot/workspace_3.8.3/THA/src/main/java/com/rondox/sb/th/repository/ProductTypesRepository.java:[7,49] cannot find symbol
  symbol: class CrudRepository
[ERROR] /D:/RondoWare/Programming/SpringBoot/workspace_3.8.3/THA/src/main/java/com/rondox/sb/th/controller/ProductTypeController.java:[29,39] cannot find symbol
  symbol:   method save(com.rondox.sb.th.model.ProductTypes)
  location: variable productTypesRepository of type com.rondox.sb.th.repository.ProductTypesRepository
[ERROR] /D:/RondoWare/Programming/SpringBoot/workspace_3.8.3/THA/src/main/java/com/rondox/sb/th/controller/ProductTypeController.java:[36,46] cannot find symbol
  symbol:   method findAll()
  location: variable productTypesRepository of type com.rondox.sb.th.repository.ProductTypesRepository
[INFO] 4 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.795 s
[INFO] Finished at: 2017-04-15T19:37:52+07:00
[INFO] Final Memory: 26M/267M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project THA: Compilation failure: Compilation failure:
[ERROR] /D:/RondoWare/Programming/SpringBoot/workspace_3.8.3/THA/src/main/java/com/rondox/sb/th/repository/ProductTypesRepository.java:[3,43] package org.springframework.data.repository does not exist
[ERROR] /D:/RondoWare/Programming/SpringBoot/workspace_3.8.3/THA/src/main/java/com/rondox/sb/th/repository/ProductTypesRepository.java:[7,49] cannot find symbol
[ERROR]   symbol: class CrudRepository
[ERROR] /D:/RondoWare/Programming/SpringBoot/workspace_3.8.3/THA/src/main/java/com/rondox/sb/th/controller/ProductTypeController.java:[29,39] cannot find symbol
[ERROR]   symbol:   method save(com.rondox.sb.th.model.ProductTypes)
[ERROR]   location: variable productTypesRepository of type com.rondox.sb.th.repository.ProductTypesRepository
[ERROR] /D:/RondoWare/Programming/SpringBoot/workspace_3.8.3/THA/src/main/java/com/rondox/sb/th/controller/ProductTypeController.java:[36,46] cannot find symbol
[ERROR]   symbol:   method findAll()
[ERROR]   location: variable productTypesRepository of type com.rondox.sb.th.repository.ProductTypesRepository
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

我的 pom.xml :

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.rondox.sb.th</groupId>
    <artifactId>THA</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>THA</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

        <!-- JPA Data (We are going to use Repositories, Entities, Hibernate, etc...) -->

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>            
        </dependency>

         <!---->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

我的依赖树:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building THA 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.springframework:spring-jdbc:jar:4.3.7.RELEASE is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.jboss:jandex:jar:2.0.0.Final is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.springframework.data:spring-data-jpa:jar:1.11.1.RELEASE is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ THA ---
[INFO] com.rondox.sb.th:THA:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:1.5.2.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.5.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.5.2.RELEASE:compile
[INFO] |  |  |  \- org.springframework:spring-context:jar:4.3.7.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.2.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.11:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.11:compile
[INFO] |  |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.24:compile
[INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.24:compile
[INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.24:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] |  +- org.springframework.boot:spring-boot-starter-web:jar:1.5.2.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.2.RELEASE:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.11:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.11:compile
[INFO] |  |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.11:compile
[INFO] |  |  +- org.hibernate:hibernate-validator:jar:5.3.4.Final:compile
[INFO] |  |  |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  |  |  \- com.fasterxml:classmate:jar:1.3.3:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.7:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.7:compile
[INFO] |  |  +- org.springframework:spring-web:jar:4.3.7.RELEASE:compile
[INFO] |  |  |  \- org.springframework:spring-beans:jar:4.3.7.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-webmvc:jar:4.3.7.RELEASE:compile
[INFO] |  |     \- org.springframework:spring-expression:jar:4.3.7.RELEASE:compile
[INFO] |  +- org.thymeleaf:thymeleaf-spring4:jar:2.1.5.RELEASE:compile
[INFO] |  |  +- org.thymeleaf:thymeleaf:jar:2.1.5.RELEASE:compile
[INFO] |  |  |  +- ognl:ognl:jar:3.0.8:compile
[INFO] |  |  |  \- org.unbescape:unbescape:jar:1.1.0.RELEASE:compile
[INFO] |  |  \- org.slf4j:slf4j-api:jar:1.7.24:compile
[INFO] |  \- nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:jar:1.4.0:compile
[INFO] |     \- org.codehaus.groovy:groovy:jar:2.4.9:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.2.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:1.5.2.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:4.3.7.RELEASE:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.8.9:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.5.2.RELEASE:compile
[INFO] |  |  +- org.apache.tomcat:tomcat-jdbc:jar:8.5.11:compile
[INFO] |  |  |  \- org.apache.tomcat:tomcat-juli:jar:8.5.11:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:4.3.7.RELEASE:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.0.12.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] |  |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  |  +- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss:jandex:jar:2.0.0.Final:compile
[INFO] |  |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] |  +- org.hibernate:hibernate-entitymanager:jar:5.0.12.Final:compile
[INFO] |  +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:1.11.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-aspects:jar:4.3.7.RELEASE:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.41:compile
[INFO] \- org.springframework.boot:spring-boot-starter-test:jar:1.5.2.RELEASE:test
[INFO]    +- org.springframework.boot:spring-boot-test:jar:1.5.2.RELEASE:test
[INFO]    +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.2.RELEASE:test
[INFO]    +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO]    |  \- net.minidev:json-smart:jar:2.2.1:test
[INFO]    |     \- net.minidev:accessors-smart:jar:1.1:test
[INFO]    |        \- org.ow2.asm:asm:jar:5.0.3:test
[INFO]    +- junit:junit:jar:4.12:test
[INFO]    +- org.assertj:assertj-core:jar:2.6.0:test
[INFO]    +- org.mockito:mockito-core:jar:1.10.19:test
[INFO]    |  \- org.objenesis:objenesis:jar:2.1:test
[INFO]    +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO]    +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO]    +- org.skyscreamer:jsonassert:jar:1.4.0:test
[INFO]    |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO]    +- org.springframework:spring-core:jar:4.3.7.RELEASE:compile
[INFO]    \- org.springframework:spring-test:jar:4.3.7.RELEASE:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.661 s
[INFO] Finished at: 2017-04-15T19:44:05+07:00
[INFO] Final Memory: 22M/309M
[INFO] ------------------------------------------------------------------------

当我从命令行运行应用程序时,是否应该传递任何特殊参数? 这只是简单的应用程序,当我从 STS 运行时,该功能可以按我的预期工作,但我只是想更好地了解运行应用程序时 STS 和命令行是否有不同的参数。


您必须删除 .m2 文件夹并更改依赖项的版本,然后重试更新 maven 项目。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

包 org.springframework.data.repository 不存在 spring boot jpa 的相关文章

随机推荐

  • XCode - 动态创建的标签,当我更改文本时,它仅更改最后一个标签

    所以我有一堆动态加载的标签 他们每个人都有相同的名字 因为不知道会有多少人 我有另一种方法 不是创建标签的方法 更改其中一个标签的文本 但是当我运行它时 只有创建的最后一个标签会更改 我需要它来更改具有特定标签或其他内容的那个 非常感谢帮助
  • 获取列表中每 n 个项目的一大块项目

    假设我有以下列表 l 4 3 1 5 3 5 8 11 10 4 12 2 1 最Pythonic的切片方式是什么l为了获得长度块n离开k块之间的项目 例如 如果n 2 and k 3结果应该是 4 3 5 8 12 2 使用列表理解 e
  • Xamarin.Forms 中的圆形图像

    我需要在 Xamarin Forms 中使用带有圆角的图像控件 但我没有找到任何可以做到的财产 如何制作圆形图像 我用FF图像加载 https github com molinch FFImageLoading图书馆CachedImage对
  • 将动态数组传递给 C 中的函数

    我正在尝试创建一个函数 该函数将数组作为参数 向其添加值 如果需要 增加其大小 并返回项目的计数 到目前为止我有 int main int argc char argv int mSize 10 ent a mSize int n n ad
  • 无法使用 py2exe 以“Domain\ComputerName”pyodbc 身份登录

    好的 我有一个连接到 mssql 数据库的脚本 我需要作为我已经完成的服务运行 但是当我将它作为服务运行时 它会覆盖我在使用以下命令连接到数据库时输入的凭据 广告计算机帐户 当我单独运行它而不是作为服务运行时 它运行得非常完美 我的连接字符
  • PDF 和 MFMailComposeViewController

    编写允许用户生成 pdf 并发送的应用程序部分 似乎工作正常 发送的 PDF 在 MAC 上可以正常打开 但在 iPhone 上它只是不断加载并且永远不会打开 在 Ray Wenderlich 教程的帮助下创建了一个 pdf 文档 并通过带
  • Delphi RTTI:获取属性的类

    使用Delphi 2010和RTTI 我知道如何获取对象的类类型以及如何获取 设置对象属性的值和类型 但是如何确定属性来自继承链中的哪个类 我想以不同于主类的方式使用基类的属性 考虑这段代码 TClassBase class TObject
  • 使用 SQL 对列表排序还是作为集合排序?

    我的数据库中有一些带有日期的条目 什么是最好的 用sql语句获取它们并应用order by 使用 sql 获取列表 并在应用程序中对它们进行排序collection sort or so Thanks 这是一个非常广泛的问题 很难回答 这在
  • Rust 进程使用 GitHub 操作失败,退出代码为 101

    该代码在我的本地计算机上运行良好并且没有给出任何错误 但是当我推送到 GitHub 时 构建失败了 这是我的工作流程文件的块 runs on matrix platform steps name Checkout Repository us
  • Delphi 多索引通用列表

    我正在寻找一种 TList 后代 它可以让我添加一个或多个索引 并让我通过这些索引进行搜索和查看 30分钟的谷歌搜索让我一无所获 以前肯定需要这个 我的意思是 有多少次您有一个内存索引集合 然后需要以不同的顺序显示它 Thanks AJ 你
  • 事件与路由器绑定

    我在用着导航网 https github com krasimir navigo对于一个小网站 用户被要求登录到登陆页面上的帐户 然后在验证其帐户后路由到主模板 页面对象是从 Firebase 数据库填充的 因此我初始化一个类并将多个事件和
  • 是否可以在 Sublime Text 2 中链接键绑定命令?

    有时 我想在 Sublime Text 中显示侧栏中的当前文件 然后在文件夹结构中导航 这可以使用命令来实现reveal in side bar and focus side bar然而 它们必须绑定到两个单独的按键组合 因此我必须执行 2
  • 在 SQL Server 中将月份名称转换为月份编号

    在 T SQL 中 将月份名称转换为数字的最佳方法是什么 E g January gt 1 February gt 2 March gt 3 Etc 是否有任何内置函数可以做到这一点 这个怎么样 select DATEPART MM jan
  • 如何用新列覆盖 Spark 数据框中的整个现有列?

    我想用一个新列覆盖 Spark 列 该新列是二进制标志 我尝试直接覆盖 id2 列 但为什么它不像 Pandas 中的就地操作那样工作 如何在不使用 withcolumn 创建新列和 drop 删除旧列的情况下做到这一点 我知道 Spark
  • ASP.NET Core 5.0 RouteDataRequestCultureProvider 删除 url 中的默认区域性

    我尝试向我的 asp net core 项目添加多语言功能 但 RequestLocalization 中的 net 3 1 和 5 0 之间存在一些变化 我无法得到我想要的 我为每种语言添加了资源文件 并在我的剃刀页面中使用了资源 它可以
  • Windeployqt 不会为调试应用程序部署 qwindowsd.dll

    我正在尝试使用windeployqt exe Qt 5 13 2 为 CMake 3 16 生成的调试应用程序部署 dll 除了部署的平台插件 dll 之外 所有 dll 均已正确部署qwindows dll代替qwindowsd dll当
  • 系统verilog中的打包向量与未打包向量

    看看我在 System Verilog 中维护的一些代码 我看到一些信号的定义如下 node range hi range lo x 以及其他定义如下 node y range hi range lo 我明白那个x被定义为打包的 而y被定义
  • 对特定行禁用 StyleCop

    我们在 C 项目中使用 StyleCop 但在某些情况下 我们希望避免这些规则 我知道你可以添加
  • 阻止自动化工具访问网站

    我们网站上的数据很容易被窃取 我们如何检测是否有人正在查看网站或工具 一种方法是计算用户在页面上停留的时间 我不知道如何实施 任何人都可以帮助检测并防止自动化工具从我的网站上抓取数据吗 我在登录部分使用了安全图像 但即使如此 人们也可以登录
  • 包 org.springframework.data.repository 不存在 spring boot jpa

    我对 spring boot jpa 有一个小问题 我已将依赖项添加到 POM xml 我可以从 spring 工具套件正常运行它 作为 spring boot 应用程序运行 但是当我从命令行 mvn spring boot run 运行时