Search code examples
javamavenintellij-ideajetbrains-ide

Showing compile error in IntelliJ-idea in editor


Showing compile error in IntelliJ-idea editor.

mvn clean install 

When run it will build successfully and run code normally. But in editor its unable to resolve those import. Some of the import is showing correctly some of the import it's showing error like Blow enter image description here

and actually, the dependency is present in maven dependency list

enter image description here

In the editor, it showing full of error

I modified build settings, deleted repo, updated maven to the latest version, updated the IntelliJ and tried other suggestion in StackOverflow, still no solution for this problem.


Solution

  • I believe this issue is related to the way we open this project in IntelliJ Idea as mvn clean install is working fine for you.

    While opening the project in IntelliJ, you should open maven project like this:

    • New -> Project from Existing Sources -> Select Project -> Import from External Model (Select maven here) enter image description here
    • After this, if you are asked to override .iml (idea files), you can override them. enter image description here

    This should hopefully solve your problem.