代码在Eclipse Oxygen 3中运行良好,但在Eclipse Photon中显示错误的相同代码。
错误: 无法解析 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 从下方放在您的构建路径中,这对我有用。
https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all/1.3