Intellij Cannot Resolve Symbols In Spring Starter Project

date
Jul 2, 2022
slug
intellij-cannot-resolve-symbol
status
Published
tags
Bugfix
Java
Maven
Spring Boot
IDE
summary
type
Post

Problem

I downloaded a Spring starter project from Spring Initializr, but when I opened the project in Intellij, I got cannot reslove symbol errors:
notion image

Try to fix

I googled and looked through StackOverflow, and I tried the solutions below:
  • Invalidate caches and restart
  • mvn clean install
  • Delete the .m2 directory, and then mvn clean install
  • mvn clean install -U
But nothing changes.
I tried to download more Spring boot starter projects for experiment. Then when I first opened one of those projects, I got the error below:
I searched for solutions to this error. Then I saw someone also got this error in the same version (2021.3.2) of Intellij as mine, and the problem was solved by downgrading the version of maven from 3.8.5 to 3.6.3.

What’s wrong

So FINALLY, the cannot reslove symbol problem was due to an incompatibility between the Maven and IntelliJ versions.
The release of the Maven version should be earlier than the one of Intellij.

Solution

I was using Maven 3.8.5, so I upgraded my Intellij from 2021.3.2 to 2022.1.3 (Community Edition), then everything works fine.

References


© Foy Wan 2022 - 2025