In this blog post I will show you how to start with IntelliJ IDEA plugin development. Since there is not a lot of documentation about plugin development for IntelliJ IDEA, I’ll be explaining how to create a simple plugin and execute code after a project was opened using the StartupActivity class.

I am currently developing an IntelliJ IDEA plugin for our analysis software Teamscale (similar to our Microsoft Visual Studio extension). In this post, I want to share some knowledge that I’ve learned when creating the plugin. After opening a project the plugin needs to initialize a connection to the Teamscale server. Therefore I needed to find out how to easily execute some code after a project was opened with the plugin enabled.

Preparations

Before we can start with the development, you’ll need a working IntelliJ IDEA installation. Download either IntelliJ IDEA Community or Ultimate Edition and install it.

Getting Started

First, let’s create a new plugin project. To create one use File -> New Project… and select IntelliJ Platform Plugin. Now at the top, create a new Project SDK (if you’ve never used IntelliJ IDEA, first configure the Java JDK as prompted). As Project SDK folder, select the IntelliJ IDEA installation folder. Now continue to create the project.

After the project has been created, you should be greeted by an open plugin.xml file. It contains all necessary meta information about the plugin and is the place were actions and contributions to the UI will be registered.