Running a project-modifying program in (nearly) headless mode?


Hi there.

Our project setup for IntelliJ is quite involved; we have multiple repositories and launch configurations, as well as things like using a specific compiler, compiler warnings/errors and code styles.

Whereas it's true that all of these can be variously exported and imported manually, we're looking for a way to set up a complete development environment that can just "get everything right" out of the box.

To this aim, I've started to investigate plugin development to create a "one-click setup" plugin, but then I came across this tantalising post:

The example program, which the user was gracious enough to post in full (thanks!) looks like a standalone program (i.e. with a main() method) that uses many of the APIs that I have been using in my plugin experiments, so I'm sure that my skeleton plugin code could be adapted. This would mean that the people responsible for setting up developer machines could just run the resultant program in a (nearly) headless fashion.

Unfortunately the post has little additional context about how one would go about compiling such a program. I've tried to create a gradle build for it, but it's not obvious how to import the intellij dependencies. A search on maven central shows that you can import the artifact com.intellij:openapi, but the latest version of that is 7.0.3 dating from 2008, so I doubt that that's the correct approach.

Could any kind soul point me in the right direction?



Could you please provide more details about the things that you need to setup and which are specific to your project? In most cases, these things can be achieved w/o building a dedicated plugin (e.g. by using VCS shared configuration files).


Hello Yann; thank you for your reply.

Here's a condensed summary of what we are trying to achieve:

- Create a new project;

- Add multiple (approximately 10, depending on the specific developer) modules to the project. Each module is a separate git repository.

- Currently we are using "Module from Existing Sources" for all of them, since the location of the checked-out repositories is set by an "outer" configuration script that does things like installing required packages (git, java compiler, build tools and scripts, etc).

- For the time being, the modules are currently configured to use maven, so in the GUI we have to select "Import module from external model" and select maven. We are mulling a switch to gradle, however.

- We need to install various IntelliJ plugins, although we do have a little Go tool to download and install some of them. Plugins bundled with the IU version can't be installed that way, however, for example, Jetty and Tapestry.

- We need to modify compiler settings (e.g. increasing the amount of memory used during builds, otherwise the compilers simply keel over).

- We need to modify the compiler warnings and errors settings to match the team's existing development style.

- We need to modify the Java autoformatter to not generate megadiffs from the existing codebase.

- We need to add several launch configurations with custom application and VM arguments;

- We need to add several Jetty launch configurations. The GUI for this is quite complicated, but I expect that these are all stored in a single configuration file, one per launch configuration, so we could conceivably just drop a preconfigured file into place.

In the past we have experimented with the feature of sharing configurations via a repository, but had trouble with constant merge conflicts, so decided that the only way would be to have a read-only repository for all developers.

However, I don't recall it being possible to use this to share the project + module definitions. Is this possible? Can this be achieved using "Save Project As Template"?



AFAIU every single in this list can be achieved by sharing configuration files in .idea folder and create project specific run configuration, inspection profile/formatter setting etc. Same for storing the modules/git repos/etc.

You can also define the list of required plugins in the project. There should be no conflicts in any configuration files, given all users have the same (major) version of the IDE in use.

Here's some pointers to get you started:


Please use regular product channels for any further questions:



Please sign in to leave a comment.