Alex
Alex

Reputation: 809

Import settings to IntelliJ via file system

I'm preparing an IntelliJ IDEA 2017.3 rollout for about fifty software developers working with Windows PCs. To make life a little easier for them I want to provide some default settings fitting our company infrastructure and coding guidelines.

I've found I could export a file settings.jar but every developer would have to import it manually. That's not ideal.

An other way is to share settings via built-in plugin settings repository. But I couldn't get it to work properly with a git repository located at a network share.

Maybe I could overwrite files in directory user.home/.IntelliJIdea2017.3/config/options but installations are typically restricted to write to program files directories in Windows at our company.

Question is: Is there another way to import settings in IntelliJ via file system? I heard about dropping exported settings.jar to plugins directory in IntelliJ installation directory but that's not working either.

Upvotes: 0

Views: 336

Answers (1)

yole
yole

Reputation: 97308

There is no ready-made solution for this, however, you can write a small plugin that will import your settings file on startup, and deploy it to the plugins directory of your installation of IntelliJ IDEA.

You can find the implementation of settings import here. The current implementation is not decoupled from the user interface, so you can't invoke it from your plugin, but basically the only important part for your usecase is this:

val filenameFilter = ImportSettingsFilenameFilter(getRelativeNamesToExtract(dialog.exportableComponents))
StartupActionScriptManager.addActionCommands(listOf(
  StartupActionScriptManager.UnzipCommand(tempFile, File(configPath), filenameFilter),
  StartupActionScriptManager.DeleteCommand(tempFile)))

You can simply perform the same operation in an ApplicationComponent of your own plugin.

Upvotes: 1

Related Questions