The IntelliJ IDEA Ballerina Plugin

The IntelliJ Ballerina plugin provides the Ballerina development capabilities in IntelliJ IDEA. Click on the below links for instructions on how to download, install, and use the features of the IntelliJ plugin.

Prerequisites

You need IntelliJ IDEA installed.

Note: Your IntelliJ IDE version should be compatible with the corresponding Ballerina plugin version (i.e., the same as the Ballerina distribution version) as shown in the below table.

Plugin Version Platform Version Compatibility
0.8.0 - 0.8.2 IntelliJ IDEA 2016.3 - 2016.4
0.8.3 - 0.981.0 IntelliJ IDEA 2016.3+
0.982.0 - 0.991.0 IntelliJ IDEA 2017.3+
0.991.1+ IntelliJ IDEA 2018.3+

Installing the plugin

Use either of the below approaches to install the IntelliJ Ballerina plugin.

Installing via the IntelliJ IDE

  1. Open IntelliJ, click IntelliJ IDEA in the top menu, click Preferences, and then click Plugins.

    Tip: If you are using Ubuntu/Windows, click File, click Settings, and then click Plugins.

  2. In the search bar, type "Ballerina" and press the Enter key.
  3. Click Install, and then click Accept.
  4. Click Restart IDE, and then click Restart.

Install the plugin via IntelliJ IDEA

This downloads the plugin and installs it.

Installing using the ZIP file

Follow the steps below to install the plugin using its ZIP file.

  1. Obtaining the ZIP file
  2. Installing the ZIP file via the IDE

Obtaining the ZIP file

Follow either of the below approaches to obtain the ZIP file of the Ballerina plugin.

Downloading from the JetBrains Plugin Repository

Download the IntelliJ Ballerina plugin.

Building from the source

Follow the steps below to obtain the ZIP file by building it from its source.

  1. Clone the ballerina-lang GIT repo.

  2. In a new Command Line tab, navigate to the source directory of the plugin (i.e., the <CLONED_BALLERINA_DIRECTORY>/tool-plugins/intellij directory), and execute the below command.

Info: In the above step,<CLONED_BALLERINA_DIRECTORY> refers to the path of the ballerina-lang Git repository, which you cloned locally. Tip: You need to install the Gradle Build Tool to execute the below command.

./gradlew buildPlugin

Tip: If you are using Ubuntu/Windows, execute the below command:

gradlew buildPlugin

This creates the /build/distributions/ballerina-intellij-idea-plugin-[VERSION].zip file locally in the b<CLONED_BALLERINA_DIRECTORY>/tool-plugins/intellij directory.

Installing the ZIP file via the IDE

After obtaining the ZIP file using either of the above approaches, follow the steps below to install it using the IntelliJ IDE.

  1. Open IntelliJ, click IntelliJ IDEA in the top menu, click Preferences, and then click Plugins.

    Tip: If you are using Ubuntu/Windows, click File, click Settings, and then click Plugins.

  2. Click the cogwheel icon, and then click Install plugin from disk....
  3. Browse and select the ZIP file of the plugin you downloaded.

    Important: Make sure you install the ZIP file and not the extracted JAR files. This is because the ZIP file contains of an additional library that is required by the plugin to function as expected.

  4. Click the Installed tab, click Restart IDE, and then click Restart.

Install using the Preferences option of the IDE.

Using the plugin

For information on using the IntelliJ Ballerina plugin to write Ballerina programs, see Using the IntelliJ Ballerina plugin.

Using the features of the plugin

Click on the below links to find information on the various capabilities that are facilitated by the IntelliJ Ballerina plugin for the development process.

Testing/Debugging the plugin

For instructions on testing and debugging the plugin, see Testing and debugging the plugin.