IntelliJ inspection gives Cannot resolve symbol but still compiles code
First of all you should try File | Invalidate Caches
and if it doesn't help, delete IDEA system directory. Then re-import the Maven project and see if it helps.
In some weird cases compiled classes may report wrong info and confuse IDEA. Verify that the classes from this jar report correct names using javap.
IntelliJ inspection gives Cannot resolve symbol but still compiles code
First of all you should try File | Invalidate Caches
and if it doesn't help, delete IDEA system directory. Then re-import the Maven project and see if it helps.
In some weird cases compiled classes may report wrong info and confuse IDEA. Verify that the classes from this jar report correct names using javap.
Intellij Cannot resolve symbol on import
There can be multiple reasons for this. In my case it was wrong source root issue. Invalidate caches didn't work along with other solutions.
Check your module source roots.
Project Structure (Ctrl+Alt+Shift+S).
Modules
Select your problem module.
Change tab on top of window "Sources".
Remove unwanted source roots. Keep one and add src and test source roots in this root.
Cannot resolve symbol in Intellij IDEA
You need to add your external libraries/classes under dependencies in order for IDEA to see them when doing code analysis/autocomplete.
IntelliJ inspection gives Cannot resolve symbol but still compiles code
First of all you should try File | Invalidate Caches
and if it doesn't help, delete IDEA system directory. Then re-import the Maven project and see if it helps.
In some weird cases compiled classes may report wrong info and confuse IDEA. Verify that the classes from this jar report correct names using javap.
Maven dependency “Cannot resolve symbol VectorAssembler'” in IntelliJ IDEA
You specified mllib dependency as runtime
- this means that dependency is required for execution, but not for compilation, so it won't be put into classpath for compiling your code. See this blog post for description of of different scopes available in Maven.
Replace all spark dependencies (mllib
, core
, sql
) with just single dependency (also remove hadoop dependencies):
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_${spark.scala.version}</artifactId>
<version>${spark.version}</version>
<scope>provided</scope>
</dependency>
where variables are defined as
<properties>
<spark.version>3.0.1</spark.version>
<spark.scala.version>2.12</spark.scala.version>
</properties>
Related Topics
What Is the Default Initialization of an Array in Java
How to Write a Utf-8 File with Java
How to Use a Custom Serializer with Jackson
Map Implementation with Duplicate Keys
Java Reading a File into an Arraylist
What Is Variable Shadowing Used for in a Java Class
Intellij Inspection Gives "Cannot Resolve Symbol" But Still Compiles Code
How to Merge Two Sorted Arrays into a Sorted Array
How to Get Current Moment in Iso 8601 Format with Date, Hour, and Minute
How to Catch an Exception from a Thread
Round Up to 2 Decimal Places in Java
Java: Multiple Class Declarations in One File
What Is a "Surrogate Pair" in Java
Java: How to Start a Standalone Application from the Current One When Both Are in the Same Package