Search code examples
javaintellij-ideacoding-styleformatter

How to import code style scheme on Intellij from outside the IDE


If I want to add a global scheme to my Java code style I need to go to:

  1. Settings -> Code Style -> Java
  2. I click into the engine Icon -> Import Scheme
  3. And I select some XML with the code style that I want to use

My idea is to automate this process, by creating some playbook where I install intellij and programmatically add the formatter to the fresh installation.

I found some stuff related to applying the format by running the command "idea format", but that's not what I want. I want to set the code style globally as I usually do by following the 3 step I've described previously.


Solution

  • Looking for IDE global settings under Ubuntu led me to ~/.IntelliJIdea2019.3/config/ folder. It contains various IDE files, among which codestyles and jba_config/codestyles (according to Advanced configuration - Help | IntelliJ IDEA, the latter exists if you are using IDE settings sync).

    You should then be able to simply replace the Default.xml configuration directly from within file system.