【问题标题】:spring petclinic compilation errors in eclipseeclipse中的spring petclinic编译错误
【发布时间】:2014-11-26 15:21:55
【问题描述】:

从 github 下载 spring petclinic 示例并在 eclipse 中作为现有 maven 项目打开,它因编译错误而失败。 java版本是1.7.0.51,pom.xml的spring版本是4.1.1.RELEASE。

编译错误是:- 该项目未构建,因为其构建路径不完整。找不到 org.hamcrest.core.CombinableMatcher$CombinableBothMatcher 的类文件。修复构建路径,然后尝试构建此项目

类型 org.hamcrest.core.CombinableMatcher$CombinableBothMatcher 无法解析。它是从所需的 .class 文件中间接引用的

请告诉我您的建议。谢谢

【问题讨论】:

  • 听起来项目的 pom 不包含 hamcrest-corehamcrest-all 作为依赖项。可以发一下pom的内容吗?

标签: java eclipse spring maven spring-mvc


【解决方案1】:

尝试将此添加到您的 pom 依赖项中:

<dependency>
    <groupId>org.hamcrest</groupId>
    <artifactId>hamcrest-core</artifactId>
    <version>1.3</version>
</dependency>

【讨论】:

    【解决方案2】:

    尽管存在的 m2 存储库 junit411.jar 和 hamcrest.jar 已损坏。在删除它们并让 maven 重新下载它们后修复了我的编译错误。谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-27
      • 2011-11-12
      • 1970-01-01
      相关资源
      最近更新 更多