Maven工程中,使用单元测试时发现@Test无法导入: org.Junit.Test 并出现如下报错:

Description    Location    Resource    Path    Type
Test cannot be resolved to a type   

Description    Location    Resource    Path    Type
The import org.junit cannot be resolved    line 3    MapperTest.java    /ssm-crud/src/main/java/com/crud/test    Java Problem
而且这时候已经再pom.xml导入dependency了,

Maven:Junit和Spring-test 注解无法使用

查看build path 中maven依赖:

Maven:Junit和Spring-test 注解无法使用

颜色不一样,展开发现:

Maven:Junit和Spring-test 注解无法使用

解决办法是:删除pm依赖中对单元测试的限制<scope>

Maven:Junit和Spring-test 注解无法使用

Maven:Junit和Spring-test 注解无法使用

问题解决1

相关文章:

  • 2021-11-19
  • 2022-12-23
  • 2021-04-16
  • 2022-12-23
  • 2021-11-01
  • 2021-07-05
  • 2018-07-17
猜你喜欢
  • 2021-12-12
  • 2021-11-21
  • 2021-06-18
  • 2022-12-23
  • 2021-10-12
  • 2021-09-21
  • 2022-12-23
相关资源
相似解决方案