原因 使用junit需要引入hamcrest-core 解决方案 解决方案 1 点击test导入test类即可 解决方案 2 添加下面依赖后重新加载 <dependency> <groupId>org.hamcrest</groupId> <artifactId>hamcrest-core</artifactId> <version>1.3</version> <scope>test</scope> </dependency> 重新加载