Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 604
yugi Avatar asked Jun 01 '18 05:06

yugi


2 Answers

Try:

  • file > invalidate caches / restart
  • maven tool window -> re-import / refresh: maven tool window
  • check maven settings of IntelliJ: does it point to the same settings.xml and repository as the maven from the command line? IntelliJ is shipped with it's internal maven and might use different settings / repo than your plain maven from the command line.
like image 194
BitfullByte Avatar answered Oct 17 '22 11:10

BitfullByte


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.

like image 29
abstractKarshit Avatar answered Oct 17 '22 11:10

abstractKarshit