189

Is it normal for Intelli J to take a lot of time (almost 12 hours) to update indices for a project? I just installed Intelli J on my machine and imported a rather large Maven project (13k+ files).

I understand that the project is large but I let my computer up all night and when I woke up in the morning, Intelli J still hasn't finished updating the indices for the files yet, which makes it impossible to do anything since the popup with title 'Updating Index' keep hanging there in the middle of the screen.

0x56794E
  • 20,883
  • 13
  • 42
  • 58
  • 2
    How much [memory have you allocated to IntelliJ](http://stackoverflow.com/questions/8542299/how-to-set-memory-for-the-vm-in-intellij-do-i-have-to-set-tomcat-memory-options/8542344#8542344)? I don't have any projects with that many source files, but I find it a bit unlikely it should take that long. – Dave Newton Apr 13 '13 at 18:52
  • @DaveNewton I allocated 512M for it. – 0x56794E Apr 13 '13 at 18:56
  • 1
    @abcXYZ Nowhere near enough; I wouldn't even try with anything under 1G. Check to see if you're thrashing VM. – Dave Newton Apr 13 '13 at 18:57
  • You should contact JetBrains support. They are relatively good about supporting problems like this, even for CE users. – noahlz Apr 15 '13 at 00:59
  • 1
    Sometimes, you may launch intellij from command line. It could be asking for git credentials. – GabLeRoux Aug 11 '16 at 17:21

16 Answers16

177

There are several answers in the Forums for different IntelliJ Versions, here is what I´ve tried (IntelliJ 13).

  • Give more Memory. Does not help anything with the 'Updating indices'
  • Delete .idea and iml in project. Does not help.

In the end what resolved my problem with 'Updating indices' was:

  • delete 'caches' folder in user/.IntellIJIdea13/system/
anho-dev
  • 1,871
  • 1
  • 14
  • 5
  • 126
    Thanks! I think `File / Invalidate Caches` does the same. Helped me. – Pavel Vlasov Feb 18 '15 at 11:33
  • 1
    My intellij idea actually started to update the indices after I invalidated caches, so I ended up waiting for more than an hour for real, but then it was ok. – Sepehr GH Jul 04 '20 at 06:33
  • 1
    .. or just `user/.IntelliJIdeaxxx/system/Maven/Indices`. – WesternGun Nov 02 '20 at 21:11
  • 1
    Started indexing the moment I did this as well, feeling this will take hours. They should REALLY fix this bug, at last. Love IntelliJ otherwise. – html_programmer Nov 30 '21 at 22:11
  • I did this and it worked temporarily, but then I had to keep deleting the caches each time and it stopped helping as much. Any ideas? – Sam A. Oct 06 '22 at 15:05
  • Let's try. Please take the following steps: Keep all 3rd custom plugins disabled. Close the project and remove the .idea folder from it (it makes sense to back it up first). Run through File | Invalidate Caches | Invalidate and Restart with Clear file system cache enabled. Wait for indexing to get stuck, wait for a minute or two longer. Share the logs (Help | Collect Logs and Diagnostic Data) here. – Ilya Dec 15 '22 at 08:16
129

I tried deleting the cache and it works perfectly. Thanks for the solution friends.

Just:

  1. Open IntelliJ IDEA
  2. Select the File menu
  3. Select the Invalidate Caches / Restart... menu.
    Once selected you get a pop-up with a bunch of options.
  4. Select Invalidate and Restart
    and before doing that make sure you saved all your changes else it might delete some unsaved changes.

Once you hit that, IntelliJ will restart and then you can see that all the indexing is done really fast.

Daniel A.A. Pelsmaeker
  • 47,471
  • 20
  • 111
  • 157
user2238153
  • 1,341
  • 2
  • 10
  • 9
22

Delete caches in library folder

rm -rv ~/Library/Caches/IdeaIC15/caches/

On Mac OSX the location of cache is ~/Library/Caches

Shubham Chaudhary
  • 47,722
  • 9
  • 78
  • 80
  • My situation is that I have installed both ultimate and community version. And I opened projects using ultimate version first. Only deleting caches didn't work for me. I need to delete caches and restart my system which makes the indexing issue fixed. – Michelle Mar 09 '16 at 06:08
  • 1
    works flawlessly @ShubhamChaudhary – Gaurav Feb 13 '22 at 20:29
19

In Intellij 2020.2 I faced this problem too. Restart/Invalidating cache didn't work for me. What I did was just deleting the cache folder in the following path:

C:\Users\davoud\AppData\Local\JetBrains\IntelliJIdea2020.2
Davoud
  • 2,576
  • 1
  • 32
  • 53
  • My cache directory was 2GB, probably a lot of information in there, accrued over a long time. Some from projects that I am no longer working on. Deleting the directory and letting it reindex my current project yielded an 80MB cache, and was done in 30 seconds. – Kshitiz Sharma Sep 14 '21 at 13:32
8

I was able to solve this by going to File -> Invalidate Caches / Restart

Then on the dialog that opens select "Invalidate and Restart"enter image description here

naib khan
  • 928
  • 9
  • 16
3

I had the same problem with IntelliJ 2017.2.3 - i.e. my project would keep updating indexes over and over again.

I discovered that I had gone over my disk quota in my home directory. By default IntelliJ stores the indexes in the home directory like this:

~/.IdeaIC2017.2/system/index/

The solution for me was to:

  1. Quit IntelliJ
  2. Move the whole .IdeaIC2017.2 directory to another mount which has more space:

    mkdir /space/ideaConfig
    mv ~/.IdeaIC2017.2 /space/ideaConfig/IdeaIC
    
  3. Update bin/idea.properties to point at the new index/config location:

    idea.config.path=/space/ideaConfig/IdeaIC/config
    idea.system.path=/space/ideaConfig/IdeaIC/system
    

It is possible that some of the other answers to this question were due to the same problem and were inadvertently fixed by "deleting caches folder", "invalidating caches" etc which would have potentially freed up enough disk space to build the indexes.

klshxsh
  • 31
  • 1
  • 1
2

Though the accepted and other answers may fix a particular problem, I have found that the problem with very long indexing times often comes from the fact that a repository contains or links to some directory that contains a large number of files. Often this is done for testing and the directory in question is not actually part of the project, e.g. ignored by the VCS.

The IDE does not automatically ignore those directories when indexing, but it is possible to "exclude" the directory from the project. This will prevent indexing as well.

jpp1
  • 2,019
  • 3
  • 22
  • 43
2

the easier way is as follow: file --> settings --> (uncheck) Synchronize files on frame or editor tab activation.

enter image description here

Machavity
  • 30,841
  • 27
  • 92
  • 100
2

Follow below steps to resolve Intelli J IDEA takes forever to update indices

1.Open IntelliJ IDEA
2.Select the File menu
3.Select the Invalidate Caches
4.Once selected you get a pop-up with options.
5.Click on Invalidate and Restart
Vasista TVN
  • 285
  • 3
  • 6
  • This worked for me, thank you! ps: In the pop-up that opens, there are ~5 checkboxes. I selected none of them and just clicked "Invalidate and Restart". – Svetoslav Stefanov Jun 19 '23 at 11:49
1

I guess Idea is more collecting garbage than doing useful work. Use G1 GC instead of the default.

Help -- Edit Custom VM Options

-XX:+UseG1GC

instead of

-XX:+UseConcMarkSweepGC

and of course restart Idea.

Downside: G1 tries to collect garbage before stopping the process. This is insane, but this is what it does. For a program with 16G of heap, cleaning-up took 27 minutes. So do not configure your Idea to use a 16G heap.

18446744073709551615
  • 16,368
  • 4
  • 94
  • 127
1

"Invalidate Caches.." always works for me.

Pobaranchuk
  • 839
  • 9
  • 13
0

you can manually exclude file or directory withIDEA Indexing, it can improve file load speed. some files are generated dynamic, we don't need index these files every time when we start IDEA.

Willie
  • 1
  • 2
0

So, for all of you that are still in pain because of this when using Windows (with or without WSL) you can try this: https://youtrack.jetbrains.com/issue/IDEA-293604/IntelliJ-is-hanging-during-build-process-and-indexing-process-when-working-on-the-WSL-projects.#focus=Comments-27-6427409.0-0

Windows defender can be very demanding with these things. Excluding idea64.exe process just made everything fast again for me.

Thiamath
  • 61
  • 1
  • 4
-1

probably - old bug in caching system. it happens in ALL versions, especially if you upgrade your version of IntelliJ or JDK. To fix it: 1) close the GUI. 2) go to %HOME_DIR%.IntelliJIdeaXXXX\system\caches and delete it 3) start the the GUI again.

Iakov Senatov
  • 151
  • 1
  • 5
-1

IDEA 2020.2 Right click folder under the Project, then mark as Exclude to exclude folder that you don't want to index

sung sung
  • 21
  • 1
-2

~/Library/Caches/JetBrains/IntelliJIdea2021.1 it's works for me..