Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Intellij IDEa, how to set a rule for automatically excluding the folders that match it from indexing?

Intellij IDEa automatically excludes folders with a name like "target" for example. I want to define a rule for automatically exclude some folders depending on a specific pattern instead of excluding all of them manually.

like image 605
George Lords of Castle Avatar asked Dec 05 '25 00:12

George Lords of Castle


1 Answers

Go into your project settings -> Modules menu.

Choose the right module and mark the folder you don't want to index as excluded.

This is the only way to do it. There is no automatic way to that.

Mark folder as excluded

If you have really to many folders to exclude, you can go into your PROJECT/.idea/modules folder. You should have an iml file for every module in your project. You will find a structure like

    <content url="file://$MODULE_DIR$/../..">
      <excludeFolder url="file://$MODULE_DIR$/../../.gradle" />
      <excludeFolder url="file://$MODULE_DIR$/../../build" />
      <excludeFolder url="file://$MODULE_DIR$/../../node_modules" />
      <excludeFolder url="file://$MODULE_DIR$/../../target" />
    </content>
    <orderEntry type="inheritedJdk" />

You should be able to add all your exclude folders using some bash magic.

HTH

like image 145
Peter Avatar answered Dec 07 '25 19:12

Peter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!