IntelliJ Maven Plugin Issues and Solutions
A checklist of solutions to fixing Maven build/caching errors on IntelliJ
[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 :
- Using the MAVEN_HOME path (in this case my installation managed by SdkMan)
- Bundled Maven; this comes packaged with IntelliJ
- 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
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.
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 ☢️
File-->Invalidate Cache from the IntelliJ menu is always a last resort but a sure solution to fixing any Maven build issues.