IntelliJ Maven Plugin Issues and Solutions

A checklist of solutions to fixing Maven build/caching errors on IntelliJ

IntelliJ Maven Plugin Issues and Solutions

[Update as of Idea 2021.1 is more stable with Maven, I would recommend upgrading to this version or later]

Veterans of IntelliJ will know that it works great most of the time, however sometimes it behaves weirdly. Especially when using a dependency and build management tool like Maven.

Here are a variety of solutions and checks to make sure Maven is working optimely with IntelliJ.

1. Check the Maven Home Path in Settings

There are generally three options to use Maven :

  1. Using the MAVEN_HOME path (in this case my installation managed by SdkMan)
  2. Bundled Maven; this comes packaged with IntelliJ
  3. Maven Wrapper

Depending on your setup, I would recommend options 1 or 3. As they will have better context of settings.xml on your machine.

2. Delete jarRepositories.xml

Highlighting the jarRepositories.xml

If you are using external or private custom repositories on Artifactory etc. then it can be useful to delete this file and reload the project.

3. Run mvn idea:idea

Despite this plugin being deprecated in maven it will refresh all IntelliJ project files.

mvn idea:idea

4. Delete .idea folder, re-import maven project from pom.xml

This option will trigger IntelliJ to re-index the Maven project and force download or add libraries to the classpath when building.

5. [Nuclear Option] Invalidate caches and Restart ☢️

Selecting File-->Invalidate Cache from the IntelliJ menu is always a last resort but a sure solution to fixing any Maven build issues.


References:

https://youtrack.jetbrains.com/issue/IDEA-237320?_ga=2.235486722.203129946.1591253608-322129264.1584010541

Package doesn’t exist error in intelliJ
I’m trying to use the barbecue barcode printing library. I have successfully added the library to IntelliJ through project structure add library. Then I imported the packages and wrote the methods,