How do I commit my IntelliJ IDEA Global Library configuration into source code control? - intellij-idea

I have IntelliJ IDEA 13.1 running on a number of machines, all with identical paths for the project and modules but different local user names. The .idea directory gets committed to the git repo. When I make changes to my Global Libraries those are not reflected on the other machines because that info is in
C:\Users\user\.IdeaIC13\config\options\applicationLibraries.xml
I want changes to Global Library settings to be required only once and applied everywhere.
Should I tell IDEA to look for applicationLibraries.xml under the .idea directory instead of in the local user's directory which is not under version control? how?

Solution was to go into Project Structure, right click on each Global Library and choose "Copy To Project Libraries..." then remove the original from Global Libraries. Then in each project remove the old global library and add the newly created project library. This way library data is stored in the .idea dir and not the user's dir.

The applicationLibraries.xml file, among others, are stored in a platform-dependent folder in the repo, for example in _linux or _windows. If this is your problem, read on.
For things like keymaps this is wanted because things work differently after all, but for libraries which either only contain jars, or contain binaries (dll/so) for all platforms, this is unwanted.
On the PC with the global libraries (assuming linux for now):
Copy the file from config/settingsRepository/repository/_linux to _windows,
Execute git add _windows/applicationLibraries.xml from the command line,
Restart IntelliJ,
Merge repo (not Overwrite remote)
This solved it for me, and now I have global libraries on all my computers, and not just my linux computers.

Related

IntelliJ different project settings based on used IDE

I have a Git repo with two directories:
backend (PHP/Laravel code)
frontend (TypeScript/Vue code)
I would like that backend is marked as excluded when the project is opened in WebStorm and frontend to be excluded when it is opened in PhpStorm.
This is to ensure that searches/indexing only happen for the files that I would actually edit in that specific IDE.
When I change the excluded directory it seems to automatically apply this to the other IDE as well. Is there some way to keep this setting separate?
Comments:
I intentionally have both frontend and backend in one repository.
Opening the subdirectories in their own IDEA projects does not seem
to be an option because the Git integration only works when the
project is in the root folder of the repository.
When I change the excluded directory it seems to automatically apply this to the other IDE as well.
It is expected. That's because the project settings are stored in the .idea subfolder. All IDEA-based IDEs use the same .idea settings format. So opening the same folder/project in different IDEs simply makes them use that already-made config (shared between IDEs).
Plus, both PhpStorm and WebStorm use the same module type ID (WEB_MODULE) and can have only 1 module in total in a project. IntelliJ IDEA and some other IDEs (like PyCharm for example) can work with projects that can have more than one module and of different types.
Is there some way to keep this setting separate?
Yes, with the help of a small workaround: you need to store .idea used by another IDE in another place. As simple as that.
The setup and steps:
Lets assume that you have your project in C:\Projects\MyProject.
Make a brand new empty project in another place, e.g. C:\Projects\IDEProjectsStore\MyProject-frontend. It will be used for a frontend.
Go to Settings/Preferences | Directories and remove an existing Content Root (which will be C:\Projects\IDEProjectsStore\MyProject-frontend from the previous step).
Add new Content Root instead -- point to the actual project (C:\Projects\MyProject from step #1)
Save and configure as needed.
What you will have now:
This frontend project will now have its settings stored in C:\Projects\IDEProjectsStore\MyProject-frontend\.idea while another (original project with backend) will have them in C:\Projects\MyProject\.idea.
Projects (project-specific IDE settings) are stored in 2 separate places while they both use the same folder with the code.
Basically: a project in the IDE's eyes is an .idea folder with a parent folder added as a Content Root by default. Our workaround keeps the second project in a different folder while sharing the same Content Root between them.
https://youtrack.jetbrains.com/issue/IDEA-170102/ -- that's a ticket that asks for a straightforward way of doing this.
I would like that backend is marked as excluded when the project is opened in WebStorm and frontend to be excluded when it is opened in PhpStorm.
Why do you need two IDEs for this?
In case if you do not know: PhpStorm = WebStorm + PHP + Database. You do not really need WebStorm here. Just install any missing plugins that come bundled with WebStorm.

How do I use PyCharm and WebStorm in the same project simultaneously?

I am working on a Django project using React for some aspects and seeing that I have licenses for both WebStorm and PyCharm, I would like to use both.
If I open them simultaneously, they keep having to reload the project. More specifically every time one of the IDEs receives focus, it prompts me to reload the project iff, the other IDE received focus since the last window switch.
I suspect this is because they are using the same folder (i.e. {project_root}/.idea) to store there cache/shelved changes etc.
Were can I change the setting, where these infos are stored in order to allow both IDEs to function alongside each other?
Idea-based IDEs (WebStorm, PyCharm, PHPStorm, IDEA, etc) have the same project format (.idea) but different settings/module types that aren't always compatible, plus each IDE needs to write its stuff to project files (for example, .idea/workspace.xml is updated each time you open editor tab, etc., as information about recently opened files, cursor positions, etc. is stored there), so having the project opened in 2 IDEs at the same time will cause such issues.
If you like to work on the same sources in different IDEs, I'd suggest sharing the sources folder(s) but keeping the .idea folders separated: just create a new empty WebStorm project in preferred WebStorm-specific location and add your shared sources root as additional content root to it in Settings | Directories, Add Content root. Same thing should be done for PyCharm. As a result, you will have IDE-specific .idea folders and shared sources

How to programmatically configure the settings of a CLion project (.idea files)

Is there a way to configure the settings of a project in CLion (2017.2.1 or later) programmatically via a script or terminal commands?
Specifically, the settings (File > Settings) I would like to be able to set via a command or script are:
those found under the Build, Execution, Deployment menu:
CMake/Generation/Configuration
CMake/Generation/CMake options
CMake/Generation/Generation path
CMake/Generation/Build options
those found under the Version Control menu:
Add
Git/Allow force push
etc.
Rationale:
The project directory contains the .idea directory. This is automatically created by CLion as soon as you open/import a suitable repo in the IDE. As far as I can tell, all the settings I am interesting in reside under $PROJECT_DIR$/.idea/workspace.xml saved there after I painstakingly configure the settings of the project by hand.
According to https://www.jetbrains.com/help/clion/project.html:
All the settings files in the .idea directory should be put under version control except the workspace.xml, which stores your local preferences. The workspace.xml file should be marked as ignored by VCS.
However, for cases where the above is not an option - developers who use an IDE-independent system - it becomes quite important (for ease of use, consistency, trace-ability, etc.) to be able to automatically configure a cloned project for CLion with specific pre-defined settings.
What I have tried:
I have tried, copying the .idea directory of an already-configured-project in CLion over to a newly-cloned repo (which has no such .idea directory) but some settings dependent paths did not work. Also, this solution is not as elegant/straight-forward as running a script (if that is indeed a possibility)/
Furthermore, I have tried using the Export settings option (File > Export Settings...) but the extracted jar file does not hold any project configuration; it only holds code style, UI and other general settings.
I understand that CLion is not open-source but if anyone knows the necessary commands or knows of an available API or even a plugin to allow programmatically configuring these settings in a CLion project, please let me know.

How to have individual .idea folders on a shared project

We have multiple developers working on a shared project through dropbox. Each time one of the developers saves a file, the other developers get the following message:
"Project Files Changed
Project components were changed externally and cannot be reloaded:
ToolWindowManager
Would you like to reload project?"
How can each person have their own settings in a shared project so this is not a problem?
You should use VCS (Version control systems) as for example git, and ignore the IDE configuration files (.gitignore), so you can avoid the conflicts with the configuration files

How to force IntelliJ to use a different home folder

I have a computer with two hard drives. In the first one, an SSD disk, I have Windows partition (C) and on the second one (D), a raid volume, I install all the programs. I also moved my user folders (desktop, documents, downloads, pictures and videos) to D:/Users/David.
After installing IntelliJ Idea on D:/Program Filles(x86) a .IntelliJIdea13 directory appeared on D:/Users/David. No problem with this as all was working nice. Then I installed Scala plugin, created a new SBT project and build it. After this, the .sbt directory used by SBT was in C:/Users/David/.sbt but the references to the libraries in my project are pointing to D:/Users/David/.sbt. The question is, how can I force IntelliJ Idea or Scala plugin to download the libraries to D:/Users/David.sbt?
Not 100% sure if this can be a solution, you can change the HOME folder of Intellij IDEA. Look for the folder where the idea executable is. In Linux I have on
~/applications/idea13/bin
On Windows you can check the properties of the menu item. There should be file idea.properties that contains the home folder location of the idea files.
You can find more information here that describe more details:
Locations can be changed by editing the following file:
IDE_HOME\bin\idea.properties
Follow the comments in idea.properties file to change the defaults,
make sure to un-comment the lines defining these properties:
idea.config.path
idea.system.path
idea.plugins.path
idea.log.path
On the other hand you can change the location of your project to D:/Users/David. you should also have a look inside the project folder, there should be a .idea folder with has a library directory. They contains the location of the libs used in the project with their paths.
As dawez allready answered, you should edit idea.properties to set config, system, plugins and log paths.
But if you want to change the user.home path, then you must edit idea.exe.vmoptions file. Just add the following at the end of the file:
-Duser.home=your_new_user_home_path
If you use idea64.exe then you should edit idea64.exe.vmoptions file.
JetBrains had added complete set of features to support such a case and this is described here:
Changing IDE default directories used for config, plugins, and caches storage