IntelliJ updating a Path Variable

10,096

Path variables can be changed in File | Settings | Path Variables.

They are handled transparently by the IDE on project load and on project save.

When project loads and contains path variables, IDE will substitute them with the actual paths defined in Settings. If no path variable is defined yet, IDE will ask you to define it.

When the project files are saved on disk, IDE will transparently and silently replace all the paths matching defined variables with the variable name.

It works fully automatically and user doesn't have to define variables explicitly in any IDE settings, just use the actual paths in your libraries, they will be replaced with the corresponding variables on project save so that your project files are portable and other users can define different values for the path variables when opening this project for the first time.

Share:
10,096
lqbweb
Author by

lqbweb

Updated on July 24, 2022

Comments

  • lqbweb
    lqbweb almost 2 years

    This is the first time that I'm giving a chance to IntelliJ, and to be honest it's not going quite well...

    I have imported my Eclipse subprojects. They use external .jar dependencies and they are specified as with a variable, ie: $EXTERNAL_LIBS/derby.jar

    When I have imported my projects, IntelliJ recognize the variable and ask me to give it a value, which I misspointed to a wrong path. Now I see on the subproject properties all the module dependencies pointing to a wrong path.

    I go to File - Settings and change the value of my EXTERNAL_LIBS to the right path, but all the current dependencies doesn't seem to reflect the change. They still pointing to the first and wrong path.

    Am I suppose to go one by one? I do not understand how IntelliJ manages Path Variables... When I try to add a new module dependency it forces me to choose it from the hard drive, and doesn't give the change to use any of these variables.... The documentation is quite poor as well....