Java 无法解析类型org.hamcrest.Matcher。它是从必需的.class文件间接引用的

Java 无法解析类型org.hamcrest.Matcher。它是从必需的.class文件间接引用的,java,eclipse,pom.xml,hamcrest,eclipse-photon,Java,Eclipse,Pom.xml,Hamcrest,Eclipse Photon,代码在EclipseOxygen3中运行良好,但在EclipsePhoton中显示错误的代码相同 错误: 无法解析类型org.hamcrest.Matcher。它是从必需的.class文件间接引用的 pom.xml:hamcrest的依赖项 <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <ve

代码在EclipseOxygen3中运行良好,但在EclipsePhoton中显示错误的代码相同

错误: 无法解析类型org.hamcrest.Matcher。它是从必需的.class文件间接引用的

pom.xml:hamcrest的依赖项

<dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <artifactId>hamcrest-core</artifactId>
                <groupId>org.hamcrest</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>
        <scope>test</scope>
    </dependency>

有人知道如何删除此错误吗?

将hamcrest all jar从下面放到构建路径中,这对我很有用

这[为我解决了一个类似的问题]。