IntelliJ IDEA Integration
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:
Accelerate development - IntelliJ will give you recommendations on which functions, methods, and variables you can use
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.
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.
From the plugins menu on the loading screen, choose Browse Repositories and search for ScriptRunner
Install this plugin and restart IntelliJ.
Now you are ready to to enable the ScriptRunner IntelliJ integration in Jira.
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, you can enable it by setting the following dark feature key:
You are now ready to connect 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.
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.
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.
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.
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.
Things to watch out for
If this is your first time running the IDEA editor, 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, simply follow the instructions in step 2 for allowing http traffic over the local network when connecting to ScriptRunner.
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!
Have questions? Visit the Atlassian Community to connect, share, and learn with other Atlassian users and experts, including Adaptavist staff.
Want to learn more? Check out courses on Adaptavist Learn, an online platform to onboard and train new users for Atlassian solutions.