This tutorial will teach you how to write a simple gadget which can display information from Crucible on the JIRA dashboard.It uses the standard Fisheye/Crucible REST interface to retrieve information. Other gadgets you write may need to use a REST module to retrieve the specific information they require in the most efficient way.
We encourage you to work through this tutorial. If you want to skip ahead or check your work when you are done, you can find the plugin source code on Atlassian Bitbucket. Bitbucket serves a public Git repository containing the tutorial's code. To clone the repository, issue the following command:
$ git clone https://firstname.lastname@example.org/atlassian_tutorial/fecru-gadget-tutorial.git
Alternatively, you can download the source using the Downloads page here: https://bitbucket.org/atlassian_tutorial/fecru-gadget-tutorial
To do this tutorial you will need an installation of JIRA 4.0 to act as the Gadget container.
First we'll write a trivial gadget which doesn't request any information from the gadget provider.
Declare the gadget in your file:
<gadget key="trivial-gadget" location="gadgets/helloworld.xml"/>
Then create the gadget file at . You can use any directory structure under for your gadgets.
The gadget specification, contains this code:
1 2 3 4 5 6 7 8 9 10 11 12 13
<?xml version="1.0" encoding="UTF-8" ?> <Module> <ModulePrefs title="Crucible Tutorial Hello World Gadget" author_email="email@example.com" directory_title="Crucible Tutorial Hello World Gadget"> <Require feature="minimessage"/> <Optional feature="dynamic-height"/> </ModulePrefs> <Content type="html"> <![CDATA[ Hello,world! ]]> </Content> </Module>
Install your plugin into Fisheye/Crucible, then add it to JIRA thus:
Paste the URL helloworld.xml into the text field and click 'Add Gadget'.
Your gadget will appear, highlighted in yellow, in the gadget directory. Click 'Add it Now' and then 'Finished'. You should now see your trivial gadget on your JIRA dashboard.
To develop more complicated gadgets, see Gadget Development.