Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permanently exclude directory in IntelliJ

I have an IntelliJ project that includes a directory of some huge files. Since those files were added to the project, we've noticed a degradation in performance such as momentary freezes and general sluggishness. Marking the directory as excluded (context menu -> Mark Directory As -> Excluded) seems to help the problem. However, this option is never persisted across sessions, so that when I reopen IntelliJ and open the project the folder is not marked as excluded. How can I permanently mark this directory as excluded?

Running IntelliJ IDEA 13.1.4 on Mac OS X 10.9.4.

like image 323
Ben Reich Avatar asked Jul 25 '14 13:07

Ben Reich


People also ask

How do I ignore a folder in IntelliJ?

You can also just right click on your folder and select Mark Directory As > Excluded . Excluded folders (shown as rootExcluded) are ones that IntelliJ IDEA "partially ignores".


2 Answers

I am using IntelliJ IDEA 2020.1.4 and Bazel build and was trying to exclude .bazel-cache directory so that it does not pop-up in search. Unfortunately, neither osundblad's nor cobbzilla's answer resulted in permanently hiding that directory.

What helped instead:

File -> Settings -> Editor -> File Types -> Ignore files and folders

and added .bazel-cache separated with ;.

like image 102
Rustam Aliyev Avatar answered Oct 08 '22 03:10

Rustam Aliyev


To expand on osundblad's answer, this now works fine in more recent versions of IntelliJ:

  • Open the module settings for the source module that is rooted somewhere above the directories you want to exclude. If you right-click on the directory in the Project view, you should see Open Module Settings in the context menu, click that.
  • The "Project Structure" window should appear, with tabs named Sources, Paths, and Dependencies
  • In the Sources tab, at the bottom of the file-tree control, find the text box labeled Exclude Files
  • Say you had directories foo and bar/baz that you wanted to exclude: enter foo*;bar/baz*; apply/OK the changes, and they will be permanently excluded from the project.
like image 36
cobbzilla Avatar answered Oct 08 '22 03:10

cobbzilla