IntelliJ IDEA 2018.2 Help

Sources Tab

Use the Sources tab of the Module page to select the supported language level for Java and to configure the module contents.

The module contents are configured by adding and removing the module content roots as well as by assigning individual folders (within the content roots) to categories such as sources and test sources, and also by excluding the folders.

Language level list

ItemDescription
Language level Use this list to select the Java language level for the module. The available options correspond to JDK versions.

You can select the level set for the project (the option <Use project language level>) or set an individual level for the module.

The left-hand pane

The left-hand pane shows a tree of folders for a module content root. If the module has more than one content root, the structure shown corresponds to the content root selected in the right-hand pane.

The folders belonging to different categories have different icons.

The following table lists the available toolbar buttons (the Icon column) and explains their functions (the Description column). Note that the corresponding functions can also be accessed as the context menu commands. These are listed in the Command column.

Most of the icons/commands work as toggles, and can be used to cancel the corresponding assignment (to make a folder "an ordinary folder").

IconCommandDescription
icons modules sourceRoot svg Sources Use this icon or command to assign the selected folder or folders to the source folder category.
icons modules testRoot Tests Use this icon or command to assign the selected folder or folders to test sources.
icons modules resourcesRoot svg Resources For Java modules: use this icon or command to assign the selected folder or folders to resources.
icons modules testResourcesRoot Test Resources For Java modules: use this icon or command to assign the selected folder or folders to test resources.
icons modules excludeRoot svg Excluded Use this icon or command to make the selected folder excluded.

Exclude files. The files and folders whose names match at least one of the specified patterns are made excluded.

The right-hand pane

The right-hand pane shows the module content roots.

For each content root, a categorized view of the module folders is provided. The categories are the source folders, test source folders, etc.

The "ordinary" folders are not shown in this view.

The individual folders within the categories are identified by their paths. The folder paths are all relative to the module root folder (content root).

The folder paths, functionally, are hyperlinks that let you jump to the corresponding folders in the tree shown in the left-hand pane.

If a module has more than one content root, selecting a content root in the right-hand pane also switches the tree view in the left-hand pane. That is, when you click somewhere within the content root area, the folder structure of this particular content root is shown in the left-hand pane.

The following table lists the controls available in the right-hand pane (icons) and describes their functions.

IconTooltipDescription
icons general add svg Add Content RootUse this icon to add a content root. Select the folder to be added as a content root in the dialog that opens.
icons diff removeRemove Content EntryUse this icon to remove the corresponding content root from the list of the content roots.
icons modules setPackagePrefix Edit propertiesAvailable in Java modules for folders marked as containing sources or resources.

Use this icon to open the Edit Root Properties dialog in which you can specify:

  • A package prefix for the selected source folder.

    Specifying the package prefix (e.g. com.mycompany.myapp) eliminates the necessity to create the corresponding folder structure (e.g. com/mycompany/myapp).

  • An output path for the selected resource folder. See Configure content roots.
  • Whether the folder contains generated sources or resources (the For generated sources or For generated resources checkbox).
icons diff removeUnmarkUse this icon to remove the folder from the corresponding category. As a result, the folder becomes "an ordinary folder", that is, not belonging to any specific category.
Last modified: 4 September 2018

See Also