Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

With IntelliJ IDEA, how can I exclude a directory from a project without opening the IDE?

For reasons beyond my control, many of my project directories must contain several symbolic links to directories containing huge numbers of files (potentially hundreds of thousands) on a network file system. These are located parallel to the root pom.xml.

When IntelliJ attempts to index these directories, it freezes up (I expect it would finish eventually). Often I can mark these directories as excluded so IntelliJ will not index them. However, these directories are sometimes created after initial project import. If IntelliJ catches them before I can mark them as excluded, it freezes. Worse, when I restart and attempt to open the project, it immediately freezes again.

How can I mark that these directories should be excluded without actually opening the project in IntelliJ IDEA?

like image 259
Ryan Gabbard Avatar asked Feb 18 '15 20:02

Ryan Gabbard


People also ask

How do I ignore a folder in IntelliJ?

In the Settings/Preferences dialog Ctrl+Alt+S , click Directories . In the Exclude files field, type the masks that define the names of files and folders to be excluded, for example, *.

What is excluded directory in IntelliJ?

Excludes Use this page to specify files and directories within your project that should not be passed to the compiler. In this field, the path to a file or directory to be excluded from compilation is shown. For a directory: select this option to exclude from compilation all the corresponding subdirectories.

How do I exclude a package in IntelliJ?

press ctrl + shift + a , and in the input box that appears type excludes , and select the first item that appears.

How do I exclude a class in IntelliJ?

In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Build, Execution, Deployment| Compiler | Excludes.


1 Answers

You can edit the project file directly to exclude these directories. Find the .iml file for your project. Add excludeFolder elements under the content element like this:

<?xml version="1.0" encoding="UTF-8"?>
  <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
    <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
      <!-- other things will be here -->
      <content url="file://$MODULE_DIR$">
        <excludeFolder url="file://$MODULE_DIR$/directoryToExclude" />
        <excludeFolder url="file://$MODULE_DIR$/target" />
      </content>
      <!-- etc -->
like image 126
Ryan Gabbard Avatar answered Nov 15 '22 11:11

Ryan Gabbard