Change 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.
In the Settings/Preferences dialog Ctrl+Alt+S, select Build, Execution, Deployment.
On the Compiler page, 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.
- On the Excludes page, specify the files and folders that shouldn't be included in compilation. Use to add items to the list.
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.
- On the Java Compiler page, check if the compiler being used is the one that you want. If necessary, select a different compiler.
Apply the changes and close the dialog.