Book Image

JIRA 5.x Development Cookbook

Book Image

JIRA 5.x Development Cookbook

Overview of this book

JIRA provides issue tracking and project tracking for software development teams to improve code quality and the speed of development. "JIRA 5.x Development Cookbook" is a one stop resource to master extensions and customizations in JIRA. You will learn how to create your own JIRA plugins, customize the look and feel of your JIRA UI, work with workflows, issues, custom fields, and much more. "JIRA 5.x Development Cookbook" starts with recipes on simplifying the plugin development process followed by a complete chapter dedicated to the plugin framework to master plugins in JIRA. Then we will move on to writing custom field plugins to create new field types or custom searchers. We then learn how to program and customize workflows to transform JIRA into a user friendly system. Reporting support in an application like JIRA is inevitable! With so much data spanning across different projects, issues, and so on, and a lot of planning done for the project, we will cover how to work on reports and gadgets to get customized data according to our needs. We will then look at customizing the various searching aspects of JIRA such as JQL, searching in plugins, managing filters, and so on. "JIRA 5.x Development Cookbook" steers towards programming issues, such as creating, editing, and deleting issues, creating new issue operations, managing the various other operations available on issues via the JIRA APIs, and so on. In the latter half of "JIRA 5.x Development Cookbook", you will learn how to customize JIRA by adding new tabs, menus, and web items, communicate with JIRA via the REST, SOAP or XML/RPC interfaces, and work with the JIRA database. The book ends with a chapter on useful and general JIRA recipes.
Table of Contents (19 chapters)
JIRA 5.x Development Cookbook
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Adding plugin modules


In this recipe, we will look at adding plugin modules into an existing plugin project.

Getting ready

Make sure the plugin project already exists, or create a new skeleton project as explained in the previous recipe.

How to do it…

Following are the steps to add plugin modules into an existing plugin project:

  1. Open a command window and go to the plugin project folder where pom.xml resides.

  2. Type atlas-create-jira-plugin-module and press Enter. This will show all the available plugin modules as a numbered list, as shown in the following screenshot:

  3. Select the number against the module that you are planning to add. For example, type 25 and press Enter if you want to add a simple Web Item module to the plugin.

  4. Follow the instructions to provide details required for the selected module. Some of the options may have default values.

    Note

    Some modules might also have an advanced setup. Type Y and press Enter when prompted if you want to go to Advanced Setup. If not, type N and press Enter.

  5. Once the module is completed, type Y or N and press Enter when prompted, depending on whether you want to add another module or not.

  6. Repeat the steps for every module you want to add.

  7. Wait for the BUILD SUCCESSFUL message to appear when no more modules are there to be added.

How it works…

Similar to the skeleton plugin creation, a set of directories and subdirectories are created during the process of adding plugin modules, along with a number of Java files or Velocity templates required for the selected plugin module.

It also adds the plugin module definition in the atlassian-plugin.xml file based on our inputs in step 4. A sample plugin descriptor, after adding the Web Item module, is shown as follows:

<?xml version="1.0" encoding="UTF-8"?>
<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>
  <resource type="i18n" name="i18n" location="com.jtricks.demo.demoplugin"/>
  <web-item name="My Web Item" i18n-name-key="my-web-item.name" key="my-web-item" section="system.user.options/personal" weight="1000">
    <description key="my-web-item.description">The My Web Item Plugin</description>
    <label key="my-web-item.label"></label>
    <link linkId="my-web-item-link">http://www.j-tricks.com</link>
  </web-item>
</atlassian-plugin>

As you can see, a web-item module is added. You can also see a resource module, which is added automatically the first time a plugin module is created. This will be the i18n resource file for the plugin, and more key-value pairs will be added into this file when more modules are added. The file has the name {plugin-artifact-name}.properties and is created under the src/main/resources{plugin-group-folder} folder. In our example, a demo.properties file is created under the src/main/resources/com/jtricks/demo folder.

A sample property file is shown as follows:

my-web-item.label=J-Tricks
my-web-item.name=My Web Item
my-web-item.description=The My Web Item Plugin

See also

  • The Creating a skeleton plugin recipe

  • The Deploying a JIRA plugin recipe

  • The Making changes to and redeploying a plugin recipe