Intellij Cannot resolve symbol on import

前端 未结 29 1907
耶瑟儿~
耶瑟儿~ 2020-11-30 18:10

This problem happens intermittently for different libraries and different projects. When trying to import a library, the package will be recognized, but the class name can\'

29条回答
  •  旧时难觅i
    2020-11-30 19:01

    I had the same issue and the reason for that was incorrect marking of the project's sources.

    I manually created the Root Content and didn't notice that src/main/test folder was marked as Sources instead of Tests. So that is why my test classes were assumed to have all their test libraries (JUnit, Mockito, etc.) with the scope of Compile, not Test.

    As soon as I marked src/main/test as Tests and rebuilt the module all errors were gone.

提交回复
热议问题