IntelliJ IDEA 14.0.0 Web Help

Path Variables

To avoid complications when moving projects from one computer to another, IntelliJ IDEA provides path variables. (A path variable, obviously, is a variable whose value is an absolute path to a directory or file.)

Path variables are particularly useful when working with third-party libraries stored outside the project directory.

To illustrate, let’s assume there is a project shared among a team of developers (e.g., through version control), and there is a library in this project defined at the project or module level.

All is well if this library is located in the project directory or one of the module content roots. This, however, is rarely the case.

A more typical situation is when the library location is external to the project and modules. Such a library is referenced by its absolute path and there’s no guarantee that this path is the same on every one of the computers used by the team.

The obvious solution is to define a path variable for the library location. In such a case, the library path may be set individually on each of the computers.

To summarize, you should define path variables under the following set of conditions:

  • There are third-party libraries in your project defined at the project or module level.
  • These libraries are stored outside the project directory and the module content roots.
  • There is a need to work with the project on more than one computer (e.g., share the project among the development team members through version control).

Ignored variables

If when opening a project, IntelliJ IDEA detects unresolved path variables, it asks you to define proper values for them. If for some reason you don’t want to do that (e.g., you are not going to use the corresponding library or libraries), you have an option of adding the corresponding variables to a list of ignored variables.

There may also be other cases when the list of ignored variables is useful.

At the internal level, path variables are represented by strings in which the name of a variable is enclosed between a pair of dollar sign characters, for example, $MY_PATH_VARIABLE$.

Such a pattern, in principle, may occur in your project without the meaning of a path variable. For example, $SOME_STRING$ may occur within program parameters passed to the JVM in a run/debug configuration, etc.

To tell IntelliJ IDEA that a string that starts and ends with a dollar sign character (e.g., $SOME_STRING$), actually, is not a path variable, you should add such a string (e.g., SOME_STRING) to the list of ignored variables.

Path variables and the list of ignored variables are configured on the Path Variables page of the Settings dialog.

See Also

Reference:

Web Resources:

Last modified: 4 December 2014
comments powered by Disqus