Step 1: Create your own SIL routine!

Hello! In this article I would like to talk on how to create your own routine in the SIL engine. 

Intro

SIL is a programming language, created by Appfire, to extend Jira and Confluence functionality. The main advantage of SIL is that SIL contains easy to use routines, which perform certain actions in Jira. For example, you want to write a program to search for issues. In Java API or groovy plugins, you would need to write about ten lines, which would make you go through Jira API and find your way on how to write these lines. Also you would need to provide compatibility of your code for Jira 7 and Jira 8. But in SIL you just call the selectIssues("your jql query"). That is all! This code will work for any Jira, which you have.

But, suppose, you want to do something in Jira and SIL language does not have a routine for it. In this case you have the following options:

  • Use SIL Groovy Connector - this plugin will let you execute Java API code within the SIL engine

  • Develop you own routine for the SIL engine.

In this article we will concentrate on developing our own routine.

I already wrote an article about it, explaining how it works here:

https://community.atlassian.com/t5/Agile-articles/Extend-the-Power-Scripts-add-on-for-Jira-Server-with-your-own/ba-p/987267

But as you can see, you need to do many changes to the out of the box Jira plugin, though all you need is just to add your own routine. In this article I will show you how to create a plugin with all needed environment in a couple of minutes.

1. Install SIL extension maven archetype

To create a plugin you need to have Atlassian SDK and git on your PC. First of all, you need to get the SIL extension archetype:

git clone https://alex1mmm@bitbucket.org/alex1mmm/sil-extension-archetype.git --branch v1 --single-branch

A sil-extenstion-archetype folder will be created. Move to this folder:

cd sil-extension-archetype

Then install this archetype into your local maven repository:

atlas-mvn install

2. Create a plugin

Now you can create your plugin using this archetype. Move out of the sil-extension-archetype folder :

Execute the following command:

 You will be asked to choose an archetype to create a project:

Enter 1 and you will be requested to provide properties for you project. Here are my values for the properties. You can provide your own values:

 and the plugin will be created. In my case a sil-extension folder will be created.

3. Test the plugin

You can go to the sil-extension folder and run Jira:

Open Jira in your browser:

 You will see the SIL Manager screen. Choose the New File option:

And create a file called test.sil with the following contents:

You screen will look like this:

You plugin added three routines: SayHello, SayHello2, SayHello3. In this script we check that these functions work. You can push the run button. The output in the Console tab will be:

Congratulations! You added 3 new routines to the SIL engine.

In Part 2 of this article I will tell you more on internals of the created plugin.