Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting "Cannot resolve symbol"?

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-with-selenium (http://github.com/ddavison/getting-started-with-selenium) which is a Maven project, and an old Eclipse project. I clicked the directory, then in the "Select libraries" or whatever, i selected Maven.

I've changed my build path to match correctly...

src/
  main/
    java/  <-- source folder.

  tests/
    java/  <-- tests folder.

But yet, I get "Cannot resolve symbol 'After'" Even though in the maven libraries, I see it clearly. enter image description here

Let me know if there is any additional information needed.

like image 936
ddavison Avatar asked Jan 24 '14 18:01

ddavison


2 Answers

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.

like image 57
Mark Peters Avatar answered Sep 16 '22 16:09

Mark Peters


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.

like image 29
Makoto Avatar answered Sep 18 '22 16:09

Makoto