在pom.xml配置文件中配置了如下
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency>
发现无法使用@Test、@after等等
原因:上述scope配置了Junit可用的位置,test表示只能在src下的test文件夹下面才可以使用。
解决:将<scope>test</scope>删除就可以了。