The question “How do I add links to Confluence / My Website / My Blog / etc. to JIRA’s main navigation?” has been asked a few times over on Atlassian Answers so I thought I’d blog the solution I usually use, which is to create a simple plugin.
Plugin development can be a scary thought, but the Atlassian make things really easy and all you’ll need for this plugin is the Atlassian SDK and your favourite text editor.
Download and Install the Atlassian SDK
Download the Atlassian SDK and follow the installation instructions. For this plugin there’s no need to configure the SDK to work with an IDE as you can just use your favourite text editor, though for more advanced plugins it is definitely worth using an IDE.
Create the Plugin Skeleton
After installing the SDK run the following command to launch the interactive prompt to create the plugin skeleton:
atlas-create-jira-plugin
At the prompts enter the following information:
Create a plugin for?: 2 – Regular ‘ol JIRA 4 (or earlier)
Define value for groupId: com.<your company domain>.jira.plugins
Define value for artifactId: jira-menu-items
Define value for version: 1.0
Define value for package: com.<your company domain>.jira.plugins
Confirm values: Y
NB: for groupId and package substitute <your company domain> with the relevant value, e.g. com.networkedcollaboration.jira.plugins.
After entering the above values you should see:
[INFO] ------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------
[INFO] Total time: 3 minutes 13 seconds
[INFO] Finished at: Sat Feb 18 14:04:15 GMT 2012
[INFO] Final Memory: 35M/107M
[INFO] ------------------------------------------
and the SDK will have created a directory called “jira-menu-items” containing all of the necessary plugin files in the directory where you ran the “atlas-create-jira-plugin” command.
If the plugin skeleton fails to build check the Troubleshooting and FAQ documentation.
Test the Plugin Skeleton
Following a successful build it’s a good idea to check that the plugin skeleton deploys and installs correctly before adding your specific plugin functionality.
Change to the “jira-menu-items” directory and type:
atlas-run
It may take a while to run the first time as Maven downloads all of the project dependencies, but after a while you should see:
[INFO] [talledLocalContainer] Tomcat 6.x started on port [2990]
[INFO] jira started successfully in 140s at http://Andrew-Fraylings-MacBook-Pro.local:2990/jira
[INFO] Type Ctrl-D to shutdown gracefully
[INFO] Type Ctrl-C to exit
Visit http://localhost:2990/jira in a web browser, log in with admin/admin, select Administration -> Plugins -> Plugins and you should see:

Again, if you encounter any problems visit the Troubleshooting and FAQ documentation.
Adding Menu Items to the Plugin
Now that the skeleton plugin has been tested to ensure that it is all working correctly it’s time to add your details to the plugin meta data and actually add the menu items that you wish to include.
Open the jira-menu-items/pom.xml file and find the section that looks like:
<organization>
<name>Example Company</name>
<url>http://www.example.com/</url>
</organization>
change the <name> and <url> to reflect your details, e.g.:
<organization>
<name>Networked Collaboration</name>
<url>http://www.networkedcollaboration.com/</url>
</organization>
Also update the <description>:
<description>This is the com.networkedcollaboration.jira.plugins:jira-menu-items plugin for Atlassian JIRA.</description>
to provide a meaningful description for the plugin, e.g.
<description>This plugin adds a new top level JIRA navigation menu with links to the Networked Collaboration website, blog and wiki.</description>
Save the jira-menu-items/pom.xml file.
Next we need to add the plugin modules that will provide the actual menu items, which for this plugin are a Web Section and Web Items. Open the jira-menu-items/src/main/resources/atlassian-plugin.xml file in your favourite text editor and you’ll see it’s pre-populated with:
<atlassian-plugin key="${project.groupId}.${project.artifactId}" 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}" />
</plugin-info>
</atlassian-plugin>
After the closing </plugin-info> element, but before the closing </atlassian-plugin> element we need to add a <web-section>:
<web-section key="my-links-section" name="My Links Main Section" location="my-links-link" weight="10" />
Following the <web-section> item we add a <web-item> to define the top-level menu item:
<web-item key="my-links-link"
name="Links on My Links Main Section"
section="system.top.navigation.bar"
weight="47">
<label>Networked Collaboration</label>
<link linkId="my-links-link">http://www.networkedcollaboration.com/</link>
</web-item>
The section=”system.top.navigation.bar” attribute defines that the menu item should be placed in the navigation bar, for details of all allowed locations see the Locations section of the Web Fragment documentation.
Following this top level menu item we add three more links for website, blog and wiki repectively:
<web-item key="website-link"
name="Networked Collaboration Website"
section="my-links-link/my-links-section"
weight="10">
<label>Website</label>
<link linkId="website-link">http://www.networkedcollaboration.com/</link>
</web-item>
<web-item key="blog-link"
name="Networked Collaboration Blog"
section="my-links-link/my-links-section"
weight="20">
<label>Blog</label>
<link linkId="blog-link">http://blog.networkedcollaboration.com/</link>
</web-item>
<web-item key="confluence-link"
name="Networked Collaboration Wiki"
section="my-links-link/my-links-section"
weight="30">
<label>Wiki</label>
<link linkId="wiki-link">http://wiki.networkedcollaboration.com/</link>
</web-item>
Your complete atlassian-plugin.xml file should now resemble the following:
<atlassian-plugin key="${project.groupId}.${project.artifactId}" 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}" />
</plugin-info>
<web-section key="my-links-section" name="My Links Main Section" location="my-links-link" weight="10" />
<web-item key="my-links-link"
name="Links on My Links Main Section"
section="system.top.navigation.bar"
weight="47">
<label>Networked Collaboration</label>
<link linkId="my-links-link">http://www.networkedcollaboration.com/</link>
</web-item>
<web-item key="website-link"
name="Networked Collaboration Website"
section="my-links-link/my-links-section"
weight="10">
<label>Website</label>
<link linkId="website-link">http://www.networkedcollaboration.com/</link>
</web-item>
<web-item key="blog-link"
name="Networked Collaboration Blog"
section="my-links-link/my-links-section"
weight="20">
<label>Blog</label>
<link linkId="blog-link">http://blog.networkedcollaboration.com/</link>
</web-item>
<web-item key="confluence-link"
name="Networked Collaboration Wiki"
section="my-links-link/my-links-section"
weight="30">
<label>Wiki</label>
<link linkId="wiki-link">http://wiki.networkedcollaboration.com/</link>
</web-item>
</atlassian-plugin>
Save the jira-menu-items/src/main/resources/atlassian-plugin.xml
Reload the Plugin to Test Changes
Now that we’ve added the relevant menu items to the plugin we need to reload it to test the changes and make sure everything is working correctly. With Atlassian’s FastDev this is really easy, just visit http://localhost:2990/jira/plugins/servlet/fastdev in your browser and hold <SHIFT> + Refresh to reload the plugin and after a few seconds you should see:

After the plugin as been successfully reloaded visit http://localhost:2990/jira and you should see:

Success
Bonus Points
The above solution adds the menu items for all users whether they are authenticated or not. If you want to restrict the menu items so that only authenticated users can see them you can do this by adding the following line to the first <web-item> in jira-menu-items/src/main/resources/atlassian-plugin.xml :
<condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition" />
e.g.
<web-item key="website-link"
name="Networked Collaboration Website"
section="my-links-link/my-links-section"
weight="10">
<condition class="com.atlassian.jira.plugin.webfragment.conditions.UserLoggedInCondition" />
<label>Website</label>
<link linkId="website-link">http://www.networkedcollaboration.com/</link>
</web-item>
Save the jira-menu-items/src/main/resources/atlassian-plugin.xml file again, reload the plugin by visiting http://localhost:2990/jira/plugins/servlet/fastdev and holding <SHIFT> + Refresh and now anonymous users will not see the extra menu items:

For details of all of the permissions that are available for you to restrict menu items see the API documentation.
Packaging the Plugin
When you’re happy that you’ve included all the links and permissions that you wish and have tested that everything is working correctly you’re ready to package the plugin so that it can be installed on your live JIRA server. To do this just change to the “jira-menu-items” directory and type the following command:
atlas-package
After a short wait you should then see:
[INFO] -------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] -------------------------------------------
[INFO] Total time: 41 seconds
[INFO] Finished at: Sat Feb 18 16:47:22 GMT 2012
[INFO] Final Memory: 66M/123M
[INFO] -------------------------------------------
and there will be a jira-menu-items-1.0.jar file in the jira-menu-items/target/ directory which you can deploy via Administration -> Plugins -> Plugins -> Install.
Related Links
For information on extending this plugin or developing your own plugins check out the following documentation:
I hope you find this plugin useful and if you have any questions or suggestions for improvements please drop me a line via the comments.