The Power Scripts add-on lets you customize your Jira Server the way you need.
You can read more about the Power Scripts add-on and its features here.
In this article will will talk about the Server and Data Center versions of this plugin.
Power Scripts uses its own language called SIL. This language hides the complexity of Jira architecture and lets you customize Jira using SIL functions, which are very easy to learn and use.
But there is also a problem, if SIL does not have a function you need, then you can not use this function.
But it is not a reason to get disappointed, you can write this function yourself using Jira Java API.
You can add your own sil functions to all these plugins
In this article I will show you how to do it.
The source code for this plugin you can download here.
You need to install Atlassian SDK and after it you can execute the following command in the terminal:
This command will create a template for a Jira Server/Data Center plugin.
You will need to answer the questions in the terminal this way:
Define value for groupId: : ru.matveev.alexey.atlas.sil.extension
Define value for artifactId: : sil-extension
Define value for version: 1.0.0-SNAPSHOT: :
Define value for package: ru.matveev.alexey.atlas.sil.extension: :
Y: : Y
Your pom.xml file should look like this:
Most important parts, which I added:
1. I added the path to cPrime repository to get the SIL library. We need this library to extend the sil language:
<name>cprime maven repository</name>
2. I added dependency for the SIL library:
3. I made the SIL library be loaded during the start of our plugin:
<!-- OBR dependencies -->
1. Add a java class for our new routine:
the executeRoutine function in this file is executed all the time our new routine called. You should put your logic there.
2. Add a java class with information of your plugin:
In the getKey method you should return the key of your plugin plugin. If you return something else, then your routine will not be loaded.
3. Add a java class to load your routine to the SIL library:
Now you can start your plugin with the atlas-run command.
Atlas-run will start Jira and install your plugin in this Jira.
After Jira started you can go to the SIL manager (http://locahost:2990/jira/plugins/servlet/silmanager) and write a script like this:
string str = myReverseString(summary);
logPrint("ERROR", "summary:" + summary);
logPrint("ERROR", "reversed summary:" + str);
Now if you execute this script, you will see the following lines in the atlassian-jira.log file:
2019-01-22 17:19:28,412 pool-32-thread-9 ERROR admin 1039x571x1 1ymwhmx 0:0:0:0:0:0:0:1 /rest/keplerrominfo/refapp/latest/async-script/runScriptFromEditor [c.k.s.lang.routines.LogPrintRoutine] summary:This is your first task
2019-01-22 17:19:28,415 pool-32-thread-9 ERROR admin 1039x571x1 1ymwhmx 0:0:0:0:0:0:0:1 /rest/keplerrominfo/refapp/latest/async-script/runScriptFromEditor [c.k.s.lang.routines.LogPrintRoutine] reversed summary:ksat tsrif ruoy si sihT
That is it. You can now write your own routines for SIL and extend cPrime plugins with new features.
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