The plugin descriptor, the only mandatory part of a plugin, is an XML file which must be named atlassian-plugin.xml
. This file is located at the root of the plugin. The atlassian-plugin.xml
file defines the various modules in a plugin. The different types of available plugin modules include reports, custom field types, and so on, and these are discussed in detail in the next chapter.
The plugin development process
The process of developing a JIRA plugin can be of varying complexity depending on the functionality we are trying to achieve. The plugin development process essentially is a four step process:
Develop the plugin.
Deploy it into our local JIRA.
Test the plugin functionality.
Make changes and re-deploy the plugin, if required.
Each of these is explained in detail through the various recipes in this book!
JIRA, on start-up, identifies all the plugins that are deployed in the current installation. You can deploy multiple plugins, but there are some things you need to keep an eye on!
The atlassian-plugin.xml
file has a plugin key which should be unique across all the plugins. It is much similar to a Java package. Each module in the plugin also has a key that is unique within the plugin. The plugin key combined with the module key, separated by a colon, forms the complete key of a plugin module.
Following is a sample atlassian-plugin.xml
file without any plugin modules in it:
The plugin, as you can see, has details such as description, version, vendor-details, and so on.
When a plugin is loaded, all the unique modules in it are also loaded. The plugin classes override the system classes and so if there is an action that has the same alias name as that of a JIRA action, it is the plugin action class that will be loaded. We will see more about extending actions in the coming chapters.
Suppose you have a report module in your plugin, it will look as follows:
The plugin key, in this case, will be com.jtricks.demo
and the module key will be com.jtricks.demo:demo-report
.
Hang on, before you start writing your little plugin for a much wanted feature, have a look at the Atlassian plugin exchange to see if someone else has already done the dirty work for you!
Atlassian plugin exchange
Atlassian plugin exchange is a one stop shop where you can find the entire list of commercial and open source plugins people around the world have written. See https://plugins.atlassian.com/search/by/jira for more details.
A common scenario that people encounter while deploying their plugin is when the plugin fails to load even though everything looks fine. Make sure your plugin's key is unique and is not duplicated in one of yours or another third-party's plugin!
The same applies to individual plugin modules.