Why am I getting “Cannot resolve symbol”?

前端 未结 3 1399
伪装坚强ぢ
伪装坚强ぢ 2021-02-14 20:54

I\'ve imported this project before, with no difficulty before. I\'m not sure what has changed.

I click Import Project and selected getting-started-wi

相关标签:
3条回答
  • 2021-02-14 21:30

    I have a project in Eclipse.

    1. Click right mouse button on your project root -> Context menu
    2. Select this menu : Maven > Update project
    0 讨论(0)
  • 2021-02-14 21:49

    Make sure that if JUnit is declared as <scope>test</scope>, that your test class is in src/test, otherwise it won't be able to see the dependency.

    0 讨论(0)
  • 2021-02-14 21:51

    Make sure that you can compile the project through Maven (that is, via command line) through mvn clean compile.

    If that generates errors, be sure that you have the junit dependency properly scoped in the POM.

    If that doesn't generate errors, then it's IntelliJ that doesn't know where the new libraries are.

    To fix that, simply go to the Maven Projects tab in the main window, and hit the "Generate Sources and Update Folders for All Projects" button. Then, hit "Reimport All Maven Projects", which is next to the previous button.

    0 讨论(0)
提交回复
热议问题