ScriptRunner brings the power of software development tools to the platform you use every day to track the software development life cycle. To help you write better scripts faster, ScriptRunner integrates with the best-in-class IDE, IntelliJ IDEA.

More information about IntelliJ IDEA can be found on the JetBrains site here.

Developing scripts with IntelliJ allows you to:

  1. Get coding recommendations - IntelliJ will give you recommendations on which functions, methods, and variables you can use

  2. Accelerate development - Speed up your scripting by running code from either IntelliJ or the Script Console as convenience dictates

  3. Access all your scripts - Securely manipulate any configured script, including those saved in your script roots

Developing with IntelliJ IDEA

Working with IntelliJ makes development easier. We still recommend that you do development in a testing environment before pushing your changes to production. Using the IntelliJ IDEA integration makes getting feedback from your scripts in a safe testing environment easier and faster.

Getting Started

First, you will need to install IntelliJ IDEA. You can download either the free Community edition or the paid Ultimate edition from the Jetbrains site.

Once you have IntelliJ installed, you will need to install the ScriptRunner IDEA integration plugin.

intellij view plugins

From the plugins menu on the loading screen, choose Browse Repositories and search for ScriptRunner

browse repositories

Install this plugin and restart IntelliJ.

install scriptrunner

Now you are ready to to enable the ScriptRunner IntelliJ integration in Jira.

Enabling the IntelliJ Integration

Right now, the IntelliJ integration is a "Dark Feature", meaning it’s turned off by default, but can be enabled. This will likely change in a future release, but until then, here’s how to turn it on.

In your Jira test instance, log in as a user with administrative privileges and paste the following at the end of your site url:

/secure/admin/SiteDarkFeatures!default.jspa

Your url might look something like my-jira-test-site.com/secure/admin/SiteDarkFeatures!default.jspa

In recent versions of Jira, this menu is available from Administration > System > Dark Features

From here, simply paste the following into the text box labled "Enable dark feature" and click Add. This will enable the IntelliJ Integration dark feature.

scriptrunner.idea.external.editor.enabled
enable dark feature

You are now ready to connect to IntelliJ!

Connecting to IntelliJ

From anywhere in ScriptRunner where you write scripts (for instance, the Script Console), you now have an IntelliJ IDEA icon at the bottom-right corner of the console. With IntelliJ running, simply click this icon.

idea icon

Once complete, navigate back to the Script Console and click the IntelliJ icon.

ScriptRunner will connect to IntelliJ and begin to create a project for you to work in. The first time you set this up it may take a few minutes, as it’s downloading all the necessary libraries for developing with ScriptRunner and your Atlassian product.

downloading sources

While this is happening, you can also navigate to my.atlassian.com to gain a copy of the source code for your Atlassian product. This is available to anyone with a paid, non-starter license of Atlassian products. When you have downloaded the appropriate source zip, simply extract it on your computer and link this to your IntelliJ project; see the guide on our Setting up a Development Environment page for more detail. You should only have to do this one time.

Developing with IntelliJ

Once you have everything linked up, you will see a few key areas in IntelliJ. First off, ScriptRunner has automatically created a project for you to work in, as well as a groovy script file which will automatically link to your running console. The new file will be under inline/src/main/groovy.

sample intellij auto project

Just start typing, and your code will automatically show up in the ScriptRunner console! Magic!

You will also see a folder on the left called Script Roots. IntelliJ will automatically sync the scripts on the Script Root folder of your Atlassian product, and allow you to modify those files directly in IntelliJ. From here, you can run files from the Script Root as you normally would in ScriptRunner.

script root

Happy scripting!

Things to watch out for

Using HTTPS

If your test instance is using HTTPS, there is one more step you will need to do to enable the communication between ScriptRunner over the local network connection. When presented with this dialog the first time you click the IntelliJ icon, simply follow the instructions for allowing http traffic over the local network when connecting to ScriptRunner.

https warning
https warning complete
Setting a JDK:

If you can find classes but IntelliJ is not giving you code completion recommendations, it is likely that there is no JDK for the project set. When you open the project the first time you should be prompted to set a JDK, but you can set this at any time by going to File > Project Structure and set a JDK version.

Please give us Feedback

We are actively developing this feature, and would love your feedback. Please file any questions or improvements at our JIRA Service Desk. We look forward to hearing from you!

For how-to questions please ask on Atlassian Answers where there is a very active community. Adaptavist staff are also likely to respond there.

Ask a question about ScriptRunner for JIRA, for for Bitbucket Server, or for Confluence.