How should I go about adding a link to the sources for a library if the source is part of another IntelliJ IDEA project? If I create a Path Variable for the library sources, Intellij will automatically update any paths in the project files (.iml files) of the library project to use the new path variable, which is problematic.
Some possible solutions which do not appear to be supported:
- Use an environment variable instead of a path variable. IntelliJ does not support using environment variables in file references (in .iml files or library .xml files).
- Limit the scope of a path variable to a single project. Path variables are global to all projects and all instances of IntelliJ. There does not appear to be any sort of per-project path variables.
- Force IntelliJ to not substitute a path variable for a given project. IntelliJ will always automatically update the paths in .iml files to use a path variable whenever possible.
As an example, I have a repository named /CollaboRhythm with a library /CollaboRhythm/CollaboRhythm.Shared. I also have a fork of the repository at /CollaboRhythm2. I have a plugin project named /DiabetesPlugin which has a dependency on /CollaboRhythm/out/production/CollaboRhythm.Shared/CollaboRhythm_Shared.swc and the sources /CollaboRhythm/CollaboRhythm.Shared/src. If I make a path variable COLLABORHYTHM_HOME for /CollaboRhythm, then /CollaboRhythm/CollaboRhythm.Shared/CollaboRhythm.Shared.iml will be updated to use COLLABORHYTHM_HOME (which is problematic). If I then change COLLABORHYTHM_HOME to point to /CollaboRhythm2, /CollaboRhythm/CollaboRhythm.Shared/CollaboRhythm.Shared.iml will now use /CollaboRhythm2/out/production/CollaboRhythm.Shared/ for the output folder instead of /CollaboRhythm/out/production/CollaboRhythm.Shared/
As a workaround I am currently placing my plugin project (DiabetesePlugin) in a subdirectory of CollaboRhythm (/CollaboRhythm/contrib/DiabetesPlugin) and then when I want to use the plugin with a different fork of the CollaboRhythm I have to move the folder (for example, to /CollaboRhythm2/contrib/DiabetesPlugin).