简体   繁体   English

使用IntelliJ IDEA,如何在不打开IDE的情况下从项目中排除目录?

[英]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 . 它们与根pom.xml平行。

When IntelliJ attempts to index these directories, it freezes up (I expect it would finish eventually). 当IntelliJ尝试索引这些目录时,它会冻结(我希望它最终会完成)。 Often I can mark these directories as excluded so IntelliJ will not index them. 通常我可以将这些目录标记为已排除,因此IntelliJ不会将它们编入索引。 However, these directories are sometimes created after initial project import. 但是,有时会在初始项目导入后创建这些目录。 If IntelliJ catches them before I can mark them as excluded, it freezes. 如果IntelliJ在我将它们标记为排除之前捕获它们,它就会冻结。 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? 如何在不实际打开IntelliJ IDEA中的项目的情况下标记应排除这些目录?

You can edit the project file directly to exclude these directories. 您可以直接编辑项目文件以排除这些目录。 Find the .iml file for your project. 找到项目的.iml文件。 Add excludeFolder elements under the content element like this: content元素下添加excludeFolder元素,如下所示:

<?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 -->

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM