Intellij Cannot Resolve Symbols In Spring Starter Project
Problem
I downloaded a Spring starter project from Spring Initializr, but when I opened the project in Intellij, I got cannot reslove symbol
errors:
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 thenmvn 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:
org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Unable to provision, see the following errors: |
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
2021.3.2版本idea配置maven出现org.codehaus.plexus.component.repository.exception.ComponentLookupException