This problem happens intermittently for different libraries and different projects. When trying to import a library, the package will be recognized, but the class name can\'
I found the source cause!
In my case, I add a jar file include some java source file, but I think the java source is bad, in Intellij Idea dependency library it add the source automatic, so in Editor the import is BAD, JUST remove the source code in "Project Structure" -> "Library", it works for me.
Intelli iDEA causes these stupid troubles @ times. Simple goto pom.xml , right click and do -> Maven -> Reimport.
This should solve the problem.
I found the following answer from @jossef-harush and @matt-leidholm useful from another link
Integer
for example) and press ALT + ENTER (or click the light bulb icon)Setup JDK
from the intentions menuConfigure
JDK
path was incorrect (pointed on /opt/jdk1.7.0_51
instead of /opt/jdk1.7.0_65
)JDK
path Had the same problem till I noticed that the src folder was marked as root source instead of java! Changing to only the java (src/main/java) to be the source root solved my problem
The same problem. If these methods not work. you can try to delete the lib from local maven repository, and reimport to pom .
Finally it' fine for me.
Right click on pom.xml file, go to Maven click on Reimport. I had similar problem and this worked for me.