IntelliJ IDEA 2017.2 Help

Specifying Compilation Settings

Compilation output locations

There are individual compilation output folders for your sources and test sources, and for each of your modules.

By default, the results of compilation are output to:

  • Sources: <ProjectFolder>/out/production/<ModuleName>
  • Tests: <ProjectFolder>/out/test/<ModuleName>

At the project level, you can change the <ProjectFolder>/out part of the output path. If you do so (say, specify some <OutputFolder> instead of <ProjectFolder>/out) but don't redefine the paths at the module level, the compilation results will go to <OutputFolder>/production/<ModuleName> and <OutputFolder>/test/<ModuleName>.

At the module level, you can specify any desirable compilation output location for the module sources and tests individually.

Specifying compilation output folders

The compilation output folders are specified in the Project Structure dialog (File | Project Structure).

Project default folder. Select Project. In the Project compiler output field, specify the corresponding path.

Module output folders. Select Modules, select the module of interest, and select Paths. The controls that you want are in the upper part, under Compiler output.

Configuring compiler settings

You can modify the list of recognized resources, exclude certain paths from compilation, select the desired compiler, configure annotation processing, etc.

  1. Open the Settings / Preferences dialog (e.g. Ctrl+Alt+S).
  2. On the Compiler page (the Build, Execution, Deployment section), you may want, for example, to modify the regular expression that describes the extensions of the files to be recognized as resources (the Resource patterns field). Use semicolons (;) to separate individual patterns. See the list of wildcard characters and examples.
  3. On the Excludes page, specify the files and folders that shouldn't be included in compilation. Use new to add items to the list.

    Note:

    • If an excluded path is a dependency of the source code being compiled, this path will be included in compilation and processed by the compiler as required.
    • If a file contains errors and fails to compile, but it is not important for the current project state, or if you want to skip some files and not to include them in the output directory, you can exclude such files from compilation.
  4. On the Java Compiler page, check if the compiler being used is the one that you want. If necessary, select a different compiler.
  5. On the Annotation Processors page, configure the annotation processing parameters.
  6. Apply the changes and close the dialog.
Last modified: 29 November 2017

See Also

Reference: