The problem “Cannot resolve symbol” means IDEA hasn’t successfully indexed your project code and dependent libraries.

There are two common problems that cause the “Cannot resolve symbol” problems: maven dependency resolve and IDEA cache.

## Step 1: Try to re-index your project files

Exit IDEA, delete the .idea folder, and restart IDEA.

When there is no .idea folder in your project root path, IDEA will re-index project files automatically.

If the “Cannot resolve symbol” errors are gone, the problem is solved. Otherwise, you can go to the next step.

## Step 2: Ensure Maven dependency resolve correctly

You should ensure that your project’s Maven dependencies are resolved correctly. Otherwise, IDEA can’t index project files successfully.

To check that Maven dependencies are resolved correctly, you can execute the following command to check it:

If you can’t pass the above commands, then there is something wrong with your Maven configuration. You can update your pom.xml and run the above commands again. Otherwise, you can go to the next step.

If you pom.xml is correct, but you still can’t pass mvn dependency:resolve or mvn clean package. You can try to force update dependencies:

After you pass mvn dependency:resolve and mvn clean package. You can try to do step 1 to re-index your project files.

## Step 3: Invalidate IDEA cache

IDEA cache also affects IDEA index project files. If your Maven configurations are right, but there are still “cannot resolve symbol” problems. You can try to Invalidate Caches:

File -> Invalidate Caches -> Checked “clear file system cache and Local History” -> Invalidate and Restart

Re-enter IDEA and waiting for “Update indexes” to complete.

After “Update indexes” is done. You can try to do step 1 to re-index your project files.