Skip to content

Instantly share code, notes, and snippets.

@develar
Last active July 29, 2019 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save develar/70e874eaa8d27958aeef2337c917e1b2 to your computer and use it in GitHub Desktop.
Save develar/70e874eaa8d27958aeef2337c917e1b2 to your computer and use it in GitHub Desktop.
answer.md

You can or add it programmatically, or just put files under the .idea/runConfigurations directory (the easiest way).

To add programmatically:

RunManagerImpl manager = RunManagerImpl.getInstanceImpl(project)
RunnerAndConfigurationSettingsImpl settings = new RunnerAndConfigurationSettingsImpl(manager);
// data it is something like JDOMUtil.load(file)
settings.readExternal(data)
manager.add(settings, false)

I didn't test this code, but should be like this.

More easy and robust way will be in the 2017.2.

@richards2019
Copy link

Hi, thank you for this helpful code.
Can I ask you if this is still up to date for IntelliJ version 2019.1.3 (CE) or what the code for this robust way is?
Thanks.

@develar
Copy link
Author

develar commented Jul 29, 2019

Code is still up to date. But instead of settings.readExternal(data) probably better to set options directly.

@richards2019
Copy link

richards2019 commented Jul 29, 2019

Thank you very much for the super quick reply. If I may ask another question, how to you set options directly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment