In the previous step, you created a skeleton for a JIRA plugin. In this part of the tutorial, you'll modify your plugin to add a new link in the JIRA menu. To do this you'll need to create a Web Section Plugin Module and a Web Item Plugin Module using the Atlassian SDK.
You should still be in the myPlugin directory after shutting down JIRA.
Open the pom.xml
file in your favourite editor.
Locate the <organization> element in the file. It should look something like this:
1 2<organization> <name>Example Company</name> <url>http://www.example.com/</url> </organization>
Update the element to include some personalized information, for example:
1 2<organization> <name>Atlassian SDK Tutorial</name> <url>http://developer.atlassian.com/</url> </organization>
Save and close the file.
Return to the **command prompt **window, and enter atlas-run and wait for JIRA to start back up.
Login if prompted
Open the Manage add-ons page in your browser using the path: localhost:2990/jira/plugins/servlet/upm
Expand the myPlugin plugin to see your changes.
When you're finished, shutdown JIRA gracefully using Ctrl+D.
Open the /src/main/resources/atlassian-plugin.xml
file from your** **myPlugin
directory in your favourite text editor.
The atlassian-plugin.xml file will look something like this:
1 2<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2"> <plugin-info> <description>${project.description}</description> <version>${project.version}</version> <vendor name="${project.organization.name}" url="${project.organization.url}" /> <param name="plugin-icon">images/pluginIcon.png</param> <param name="plugin-logo">images/pluginLogo.png</param> </plugin-info> <!-- add our i18n resource --> <resource type="i18n" name="i18n" location="myPlugin"/> <!-- add our web resources --> <web-resource key="myPlugin-resources" name="myPlugin Web Resources"> <dependency>com.atlassian.auiplugin:ajs</dependency> <resource type="download" name="myPlugin.css" location="/css/myPlugin.css"/> <resource type="download" name="myPlugin.js" location="/js/myPlugin.js"/> <resource type="download" name="images/" location="/images"/> <context>myPlugin</context> </web-resource> </atlassian-plugin>
Next, in **command prompt **make sure you're in the myPlugin
folder and then run the following command:
1 2atlas-create-jira-plugin-module
You'll be prompted to choose a plugin module from a list of possible module types (check out Plugin Modules for more information).
Type 30 to select the Web Section
plugin module type.
Now, you'll be prompted to answer a few configuration questions, answer as follows:
1 2Enter Plugin Module Name My Web Section: : mySection Enter Location (e.g. system.admin/mynewsection): my-item-link Show Advanced Setup? (Y/y/N/n) N: : N
At the moment the location my-item-link
doesn't exist, but we'll create that in the next step.
Next, you're prompted to enter another plugin module. Type Y to create another module.
Type 25 to select the Web Item
plugin module and then answer the configuration questions as follows:
1 2Enter Plugin Module Name My Web Item: : myItem Enter Section (e.g. system.admin/globalsettings): system.top.navigation.bar Enter Link URL (e.g. /secure/CreateIssue!default.jspa): deleteMe Show Advanced Setup? (Y/y/N/n) N: : N
When you are prompted to enter another Plugin Module, type N.
The system will complete the creation of the modules and you'll receive a confirmation that the build was successful.
Open the atlassian-plugin.xml file and you'll notice it has changed a little:
1 2<?xml version="1.0" encoding="UTF-8"?> <atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2"> <plugin-info> <description>${project.description}</description> <version>${project.version}</version> <vendor name="${project.organization.name}" url="${project.organization.url}"/> <param name="plugin-icon">images/pluginIcon.png</param> <param name="plugin-logo">images/pluginLogo.png</param> </plugin-info> <!-- add our i18n resource --> <resource type="i18n" name="i18n" location="myPlugin"/> <!-- add our web resources --> <web-resource key="myPlugin-resources" name="myPlugin Web Resources"> <dependency>com.atlassian.auiplugin:ajs</dependency> <resource type="download" name="myPlugin.css" location="/css/myPlugin.css"/> <resource type="download" name="myPlugin.js" location="/js/myPlugin.js"/> <resource type="download" name="images/" location="/images"/> <context>myPlugin</context> </web-resource> <web-section name="mySection" i18n-name-key="my-section.name" key="my-section" location="my-item-link" weight="1000"> <description key="my-section.description">The mySection Plugin</description> <label key="my-section.label"/> </web-section> <web-item name="myItem" i18n-name-key="my-item.name" key="my-item" section="system.top.navigation.bar" weight="1000"> <description key="my-item.description">The myItem Plugin</description> <label key="my-item.label"></label> <link linkId="my-item-link">deleteMe</link> </web-item> </atlassian-plugin>
In the web-section, delete the following:
<label key="my-section.label"/>
line.deleteMe
in the <link linkId="my-item-link">
. In this tutorial we don't want the 'myItem' menu to link anywhere, and we don't want to see the 'mySection' label in our menu.
Save your changes to the file.
Return to the **Command Prompt **window, run the atlas-run
command, and wait for JIRA to start up.
Once you've logged in, you will see the new JIRA menu.
Shut down JIRA using Ctrl+D.
Starting and stopping JIRA can take several minutes each time. QuickReload significantly reduces your plugin development iteration time, so in the next part of the tutorial, you'll learn how to use it to test a change to your plugin without restarting JIRA.
The source code for this tutorial is available on Bitbucket at bitbucket.org/serverecosystem/myplugin
Alternatively, check out the Getting Started Tutorial FAQ
Still need help? Request support at Developer Technical Support Portal
Rate this page: