In this article I would like to talk on how to create your own routine in the SIL engine.
SIL is a programming language, created by cPrime, 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:
In this article we will concentrate on developing our own routine.
I already wrote an article about it, explaining how it works here:
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.
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://firstname.lastname@example.org/alex1mmm/sil-extension-archetype.git --branch v1 --single-branch
A sil-extenstion-archetype folder will be created. Move to this folder:
Then install this archetype into your local maven repository:
Create a plugin
Now you can create your plugin using this archetype. Move out of the sil-extension-archetype folder :
Execute the following command:
atlas-mvn archetype:generate -DarchetypeCatalog=local
You will be asked to choose an archetype to create a project:
1: local -> com.cprime.jira.sil.extension:sil-extension-archetype (This is the com.cprime.jira.sil.extension:sil-extension plugin for Atlassian JIRA.)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): :
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:
Define value for property 'groupId': ru.matveev.alexey.sil.extension
Define value for property 'artifactId': sil-extension
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' ru.matveev.alexey.sil.extension: :
Confirm properties configuration:
Y: : Y
and the plugin will be created. In my case a sil-extension folder will be created.
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:
string res = SayHello2("Alexey", "Matveev");
res = SayHello3("Alexey", "Matveev");
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.
Alexey Matveev _cPrime_Community Leader
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events