Problem
When opening the maven project, there are errors highlighted for some symbols in the code, like import statements, class usage, etc.
Solution
- Check the
pom.xmland make sure all the required dependencies are valid (no errors highlighted under<dependencies>section). In the Maven tool window, the project is correctly recognized (shown in the Maven tool window, and the dependency list is correct). - Check any customized settings
- Make sure Settings | Build, Execution, Deployment | Build Tools | Maven is correctly configured.
- Go to
<project root>/.idea/workspace.xmland search for<component name="MavenImportPreferences">, make sure the context is the same as the settings.
- Try the solution in https://support.jetbrains.com/hc/en-us/articles/40249549269394--Cannot-resolve-symbol-error.
- If you have any customized settings for the maven settings file or maven repository, please make sure they are synced with the default maven settings:
-
For a customized maven repository, please add the
<localRepository>tag in~/.m2/settings.xml.<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository>/absolute/path/to/maven-repository</localRepository> </settings> -
For customized setting defined outside the default
~/.m2folder, please manually create the~/.m2folder and paste thesettings.xmlhere. -
Go to IntelliJ IDEA and click File | Invalidate Caches | check the first three options | Invalidate and Restart.
-
Comments
0 comments
Please sign in to leave a comment.