Idea Mark Directory as 下的文件夹分别代表的含义

可以将内容根目录中的文件夹分配给以下类别:

    1. Source roots (或者 source folders; 显示为 rootSource)。
    通过为此类别分配文件夹,您可以告诉IntelliJ IDEA此文件夹及其子文件夹包含应作为构建过程的一部分进行编译的源代码。
    在Java模块中,源根目录中的子文件夹代表Java包结构。
    您可以将包前缀分配给源根(例如,my.mycompany.myapp),而不是在该源根目录中创建相应的文件夹结构(例如,/ mycompany / myapp)。有关更多信息,请参阅Java源根的包前缀。
    如果没有包前缀和子文件夹,源根将表示默认包(未命名的包)。
    2. Generated source roots (或者 generated source folders; 显示为 rootGeneratedSourceIJ;;在某些视图中使用[generated]文本标记)与Source roots类似。不同之处在于,在执行Move Class重构或使用Create Class from Usage快速修复时,不会将Generated source roots认为是目标文件夹。
    3. Test source roots (或者 test source folders; 显示为 rootTest)。
    这些根类似于源根,但是用于测试的代码(例如用于单元测试)。通过测试源文件夹,您可以将与测试相关的代码与生产代码分开。
    通常,源和测试源的编译结果放在不同的文件夹中。
    4. Generated test source roots (或者 generated test source folders; 显示为 rootGeneratedTestSourceIJ;在某些视图中使用[generated]文本标记)与Test source roots类似。他们之间的差异与Source roots和Generated source roots之间的差异相同。
    5. Resource roots (或者 resource folders; 显示为 rootResourceIJ;仅在Java模块中可用)适用于应用程序中使用的资源文件(图像,各种配置XML和属性文件等)。
    在构建过程中,资源文件夹的所有内容将按原样复制到输出文件夹。
    与源类似,您可以指定生成资源。您还可以指定应将资源复制到的输出文件夹中的哪个文件夹。
    6. Test resource roots (或者 test resource folders; 显示为 rootTestResourceIJ;仅在Java模块中可用)用于与测试源关联的资源文件。在所有其他方面,这些文件夹类似于资源文件夹。
    7.  Excluded roots (显示为 rootExcluded)是IntelliJ IDEA“几乎忽略”的根。
    为Excluded roots中的文件提供了非常有限的编码帮助。Excluded roots中包含的类不出现在代码完成建议列表中,对这些类的引用在编辑器中显示为未解析。搜索时,IntelliJ IDEA不会查找排除的文件夹等。
    使排除内容“不太重要”的文件夹可以提高IDE性能。
    通常排除的是编译输出文件夹。

 

以下是idea官方介绍


Folder categories

Folders within a content root can be assigned to the following categories:

  • Source roots (or source folders; shown as rootSource).

    By assigning a folder to this category, you tell IntelliJ IDEA that this folder and its subfolders contain source code that should be compiled as part of the build process.

    In Java modules, the subfolders within the source roots represent your Java package structure.

    You can assign a package prefix to a source root (e.g.com.mycompany.myapp) instead of creating the corresponding folder structure within that source root (e.g.com/mycompany/myapp). For more information, see Package prefix for Java source roots.

    In the absence of the package prefix and the subfolders, a source root would represent the default package (an unnamed package).

  • Generated source roots (or generated source folders; shown as rootGeneratedSourceIJ; in certain views the [generated]text marker is used) are similar to source roots. The difference is that the generated source roots are not suggested as target folders when performing the Move Class refactoring or using the Create Class from Usage quick fix.
  • Test source roots (or test source folders; shown as rootTest).

    These roots are similar to source roots but are for code intended for testing (e.g. for unit tests). Test source folders let you keep the code related to testing separate from the production code.

    Compilation results for sources and test sources, normally, are placed into different folders.

  • Generated test source roots (or generated test source folders; shown as rootGeneratedTestSourceIJ; in certain views the[generated] text marker is used) are similar to test source roots. The difference is the same as between the source roots and the generated source roots.
  • Resource roots (or resource folders; shown as rootResourceIJ; available only in Java modules) are for resource files used in your application (images, various configuration XML and properties files, etc.).

    During the build process, all the contents of the resource folders are copied to the output folder as is.

    Similarly to sources, you can specify that your resources are generated. You can also specify which folder within the output folder your resources should be copied to.

  • Test resource roots (or test resource folders; shown as rootTestResourceIJ; available only in Java modules) are for resource files associated with your test sources. In all other respects, these folders are similar to resource folders.
  • Excluded roots (shown as rootExcluded) are ones that IntelliJ IDEA "almost ignores".

    Very limited coding assistance is provided for files in excluded folders. Classes contained in excluded folders don't appear in code completion suggestion lists, references to such classes are shown in the editor as unresolved. When searching, IntelliJ IDEA doesn't look in excluded folders, etc.

    Making the folders whose contents are "less important" excluded may improve the IDE performance.

    Normally excluded are compilation output folders.

参考:https://www.jetbrains.com/help/idea/2016.1/content-root.html?origin=old_help

你可能感兴趣的:(IDE)