代码之家  ›  专栏  ›  技术社区  ›  A Jar of Clay

包Or.HAMCREST不存在

  •  0
  • A Jar of Clay  · 技术社区  · 8 年前

    我明白了 java: package org.hamcrest does not exist . POM文件如下所示:

    <dependencies>
        ...
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    

    在其中一个测试中,我有一个导致错误的导入:

    import static org.hamcrest.CoreMatchers.*;
    

    我正在使用IntelliJ 2017.3.4

    我试过把 scope 标记并将其更改为 compile ,并导入其他 hamcrest 类似于 hamcrest.core . 还有,跑步 mvn clean 重建项目也没用。

    2 回复  |  直到 8 年前
        1
  •  1
  •   A Jar of Clay    8 年前

    手动删除 .idea 文件夹和重建工作。

        2
  •  0
  •   streetturtle    8 年前

    您可以尝试从本地repo中删除它(我们通常在~/.m2/repository/org/hamcrest/下),然后再次尝试构建项目。