IntelliJ IDEA 2018.2 Help

Configuring projects

Projects in IntelliJ IDEA allow you to conveniently manage modules and share settings between them. These settings include an SDK, a language level, and a compiler output.

Modules are independent entities. Each module can have its own settings and can be configured to develop framework-specific applications. Modules can reference other modules, i.e. depend on each other.

In IntelliJ IDEA, you can integrate projects with build tools, such as Maven or Gradle. In this case, the IDE will provide you with coding assistance for editing the build file, code completion, inspections and quick-fixes, refactorings, and so on.

Invalidate caches

IntelliJ IDEA caches a great number of files, therefore the system cache may become overloaded. Sometimes the caches will never be needed again, for example, if you work with frequent short-term projects.

When you invalidate the cache, IntelliJ IDEA rebuilds all projects ever run in the current version of the IDE.

Clear the system cache

  1. From the main menu, select File | Invalidate Caches/Restart.

  2. In the Invalidate Caches dialog, select an action. You can invalidate the caches and restart the IDE, invalidate the caches without restarting the IDE, or just restart the IDE.

Path variables

Path variables are placeholders that stand for paths to resources linked to your project. They provide sharing flexibility as you don't have to reference a fixed location on your computer.

Path variables are useful if, for example, you have a third-party library defined at the project or module level, and it is stored outside the project directory or module content roots (for projects shared through VCS). Such a library is referenced by its absolute path and there’s no guarantee that this path is the same on your teammates' computers. If you use a path variable, you make the path relative as each variable is configured on each computer individually.

To configure path variables, in the Settings/Preferences dialog (Ctrl+Alt+S), select Appearance & Behavior | Path Variables.

path variables dialog

Ignore path variables

When you open a project, IntelliJ IDEA checks if there are any unresolved path variables. If the IDE detects any, it will ask you to define values for them. If for some reason you don’t want to do that (for example, if you are not going to use files or directories with the unresolved path variables), you can add them to the list of ignored variables.

You can also use the list of ignored variables if, for example, a program parameter passed to the JVM in a run/debug configuration has the same format as an internal ($SOME_STRING$) path variable. In this case, you can add this parameter to the this of ignored variables in order to avoid confusion. Enter SOME_STRING to the Ignored Variables field in the Path Variables dialog.

Resource files

Resources include properties files, images, DTDs, and XML files. These files are located in the classpath of your application, and are usually loaded from the classpath using the following methods:

  • ResourceBundle.getBundle() for properties files and resource bundles

  • loadResourceAsStream() for icons and other files

When building an application, IntelliJ IDEA copies all resources into the output directory, preserving the directory structure of the resources relative to the source path. The following file types are recognized as resources by default:

The pattern of recognized resource files can be configured as a regular expression in the Compiler dialog (Settings/Preferences (Ctrl+Alt+S) | Build, Execution, Deployment | Compiler). Using the Resource Patterns text box, you can add your own file extensions and create custom list of resources.

Last modified: 20 November 2018