引入了junit为什么还是用不了@Test注解

2022-10-30 10:35:16

在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>删除就可以了。

  • 作者:萍果馅是年糕
  • 原文链接:https://blog.csdn.net/qq_52159080/article/details/123951617
    更新时间:2022-10-30 10:35:16