Troubleshooting common Maven issues
If you encounter problems working with your Maven project you can check to see if the following solutions and workarounds can help you solve your issues.
How to fix compiler version problems in Maven projects
In some cases when you import a Maven project, it might have compiler settings that will not match the expected settings in IntelliJ IDEA and when you compile your code, you might encounter a problem.
For example, you can get the following error:
This error usually indicates a problem with the compiler version compatibility and you can check few places to fix it.
- You can edit your POM and configure Maven compiler plugin to compile your Java code. You should set the compiler level explicitly, so it won't revert to the default settings when you re-import your project.
- Open your POM in the editor.
- Change the configuration for the Maven compiler plugin. Click the icon to import your changes. Also note the configurations specified in your POM overrides any configurations specified in your project structure. So, now after this project is imported the language level should be be picked up.
- Check Java compiler settings to see if bytecode versions match.
- If you have imported a multi-level project, you can check project structure settings for source language level configuration.
How to fix problems with Maven projects that won't start
To fix issues that are related to the Maven projects that won't start or import, check the following:
- If you received the
OutOfMemoryerror, try to increase heap size for the Maven importer.
- Open Settings dialog (click the icon in the Maven Projects tool window).
- Select Maven | Importing from option on the left.
- On the Importing page, in the VM options for importer field, increase heap size for the Maven importer.
- Also, in the JDK for importer field, increase IDE heap size. (Try not to exceed
-Xmxvalue if you are running on a 32-bit JVM (default), otherwise it may crash or fail to start.) If you need to use more heap, switch to 64-bit Java and specify the same 64-bit JVM for Maven JDK for importer.
- If you received the
Operation timed outerror or IDE connection failure to the Maven process, try to edit the
- If the error indicates the Maven repository issue, such as the
Failed to update Maven indiceserror, try to check if Maven repositories were indexed correctly.
IntelliJ IDEA works with repository indexes. The indexes are fetched remotely from remote repositories. Some repositories do not provide indexes, or do not keep an updated index, for example, repositories from Bintray, in this case you can ignore the error.
If you have an indexed repository, but still get a Maven repository error, check the following options:
- Open the Maven Settings dialog (click the icon in the Maven Projects tool window).
- On the Maven page, in the User settings file field, check if you defined proper credentials for the server in
You can try to restart IntelliJ IDEA and update Maven repositories.