315

In my project I have .deploy folder which is created/updated when I deploy my app locally. Is it possible to disable indexing on that folder? Everything slows down whenever I deploy and it's really annoying - I have to wait a few minutes whilist intellij doing unnecessary indexing. In module view I excluded that folder but it's not helping.

Francesco - FL
  • 603
  • 1
  • 4
  • 25
Marcin Szymaniuk
  • 3,579
  • 2
  • 19
  • 15

6 Answers6

403

Mark this folder as Excluded in the File | Project Structure | Modules | Sources tab.

Edit: also make sure it's not added as a library in the project.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • 9
    As I've mentioned above, I did it, but it's not helping. – Marcin Szymaniuk Jul 01 '11 at 09:08
  • 4
    Do you use 10.5.1? Make sure this directory is not added as a library anywhere in your project. – CrazyCoder Jul 01 '11 at 13:03
  • Don't know why intellij picked it up as a library folder but you're right - it was added as a library. Cheers – Marcin Szymaniuk Jul 01 '11 at 17:56
  • 19
    This also excludes the file from a lot of other things. I don't want to exclude the file from the project - just the index. I still want the file to appear in the list of changed files so i can commit the file (or view diffs or whatever) – B T Mar 04 '15 at 19:15
  • 1
    Agee with @BT, this is a poor solution since it exclude from the artifacts built by IntelliJ. – Chico Sokol Aug 18 '15 at 23:27
  • How can I ignore a single file? I have a PyCharm project that creates a large `.c` file from `.pyx` and PyCharm tries to index it that takes for ever. It is not in a separate directory to ignore – dashesy Sep 26 '18 at 22:59
  • 2
    @dashesy you can map it to the text file in the File Types. – CrazyCoder Sep 27 '18 at 10:12
  • @CrazyCoder that is a .c file, so I should map all .c files to a text file? this is the only generated c file (thus huge and not worth indexing), but thanks for the suggestion that will be useful. – dashesy Sep 28 '18 at 00:02
  • 1
    This wasn't working for me even after multiple "invalidate cache and restart" and even an upgrade from 2019.1 to 2019.2. What worked was right clicking on the folders that were excluded and unselecting excluded and re-excluding them. It even was able to work mid-indexing, real time, when I saw folders that should not be indexed being indexed, I just toggled the exclusion and it stopped indexing them right then and there, as expected. – Elijah Lynn Aug 19 '19 at 18:48
  • PyCharm hangs on startup, no chance to exclude a folder. – dashesy Oct 01 '19 at 17:47
  • @dashesy please submit a ticket at https://intellij-support.jetbrains.com/hc/requests/new with [idea.log](https://intellij-support.jetbrains.com/hc/articles/207241085) attached. – CrazyCoder Oct 02 '19 at 01:52
  • @CrazyCode I just did and attached the thread dumps. I have marked some symlinks to cifs-mounted directories as ignored, but apparently PyCharm still hangs on those directories. Specially when I open 2 projects in 2 windows PyCharm hangs trying to look into those (that it should not) – dashesy Oct 02 '19 at 22:28
  • 2
    Can you do that with a settings file in the root directory rather than this setting ending up in the .idea directory? – R. van Twisk Feb 18 '21 at 16:09
166

On IntelliJ 13+ (don't know for earlier versions), you can right click on a folder > Mark Directory As > Excluded.

naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
lhache
  • 1,819
  • 1
  • 13
  • 6
23

if you cannot do it throu the Modules menu because your intellij freezes (like in my case) edit .iml file of your projet and add excludeFolder line as below:

<content url="file://$MODULE_DIR$">
  <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
  <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
  <sourceFolder url="file://$MODULE_DIR$/src/test/features" type="java-test-resource" />
  <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
  <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
  <excludeFolder url="file://$MODULE_DIR$/node_modules" />
  <excludeFolder url="file://$MODULE_DIR$/target" />
</content>
Martin Valgur
  • 5,793
  • 1
  • 33
  • 45
zaki benz
  • 672
  • 7
  • 21
  • Thanks - was having this issue and this really helped. Added this to each module's iml file. Worked in 2018.1. – Rik May 06 '18 at 22:42
  • This is the only way that worked for me in IntelliJ 2019.1 – nevada_scout Apr 03 '19 at 10:30
  • All node_modules seemed as excluded in project structure and in project panel of my big project but were actually not excluded in iml file which caused index that had 15 GB and took 5 hours to make after every start of the IDE. I updated it manually based on your post and it helped. Thank you! – xMort Apr 22 '21 at 07:49
1

The option is now called Stop/Start Index, available from the folder context menu in solution explorer. When index is stopped, the folder will appear with "no index" annotation on the right.

enter image description here

I excluded the build output folder and no longer getting lengthy index refreshes after each build. Also full text search is a lot faster (near instant).

enter image description here

Victor Zakharov
  • 25,801
  • 18
  • 85
  • 151
0

After applying the Mark As > Excluded method to a folder you still might see unwanted results.

You have to explicitly mark sub-folders as well to disable certain functionalities for sub-folders.

indexing, find usages etc.

Izer Ozlu
  • 27
  • 1
  • 1
  • 7
0

Sometimes it is not possible to mark the folder as excluded. It happens with direct node dependencies.

For that, it's a bit extreme but you can add it to Editor-> File types -> ignored file types and folders. It won't be indexed at all. It won't be shown in the project either

Gabriel Furstenheim
  • 2,969
  • 30
  • 27