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 gives 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.
Working with IntelliJ makes development easier. We 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.
Install IntelliJ IDEA. You can download either the free Community edition or the paid Ultimate edition from the Jetbrains site.
Next, install the ScriptRunner IDEA integration plugin: ..Click Configure→Plugins on the loading screen.
From the Plugins menu, choose Browse Repositories and search for ScriptRunner and find the Adaptavist ScriptRunner Power Editor plugin.
Click Install to install the Adaptavist ScriptRunner Power Editor plugin and restart IntelliJ.
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 the IntelliJ IDEA icon in a ScriptRunner window (such as the Script Console).
ScriptRunner connects 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 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 documentation for more details. 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 created a project for you to work in, as well as a groovy script file which automatically links to your running console.
The new file is under
Just start typing, and your code shows up in the ScriptRunner console.
You will also see a folder on the left called Script Roots. IntelliJ syncs scripts in the Script Root folder of your Atlassian product, and allows 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 required to enable the communication between ScriptRunner over the local network connection. When presented with the following dialog, simply follow the instructions for allowing http traffic over the local network when connecting to ScriptRunner.
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.
When certain errors occur, ScriptRunner may reccomend you view the IDEA logs. To view these, follow the steps for Locating IDE Log Files.
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.