How to fix long running indexing in IntelliJ IDE

Navaneeth Sen
2 min readJan 10, 2023

The main purpose of indexing is to help the IDE provide code navigation and code completion more efficiently and thereby make things faster for the developer.

But in some rare cases, if IntelliJ is constantly indexing Gradle or Maven libraries and impacting our ability to work with the IDE, there are a few things you can try to handle this problem:

  1. Increase the amount of memory allocated to IntelliJ: By increasing the amount of memory available to IntelliJ, you can reduce the amount of time it takes to perform indexing. You can do this by going to the “Help” menu in IntelliJ, selecting “Edit Custom VM Options”, and adding the following line to the file: -Xmx<size>m, where <size> is the amount of memory you want to allocate to IntelliJ in megabytes.
  2. Disable or delete unnecessary plugins: Some plugins may cause IntelliJ to index more files than necessary. You can try disabling or deleting these plugins to see if they are the cause of the indexing issue.
  3. Exclude specific folders or files from the indexing: You can exclude specific folders or files from indexing by going to the “File” menu, selecting “Settings”, and then going to “Directories”. From here, you can select the folder or file you want to exclude and click the “Exclude” button.
  4. Manually control indexing: IntelliJ provides a way to manually control indexing of the project. By clicking on the progress bar of indexing, you can pause the indexing, resume the indexing and stop the indexing. This can be helpful when you want to index during your non-working hours or if you want to exclude certain indexing if it’s not important for your current task.
  5. Turn off background indexing: You can turn off background indexing in IntelliJ by going to “Settings” > “Build, Execution, Deployment” > “Compiler”, then unchecking the “Build project automatically” and “Use external build” options. With this option disabled, IntelliJ will only index when you explicitly tell it by clicking the “Make Project” button.

If none of these solutions work, it might be worth trying to invalidate IntelliJ caches and restarting the IDE.

You can also try excluding the libraries and modules that you do not work on. But I don’t think this should be really necessary unless this is a really big project.

Please put in your comments if you find some other technique to solve the above issue.

--

--

Navaneeth Sen

Software Engineer | Java, Python, Linux, Unix | AI, DVB | 💻 | Azure | PyTorch | Hackathons | Innovations | Highly Inquisitive and Curious