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

Using FastDev for plugin development


We have seen how to use atlas-cli to reload a plugin without having to restart atlas-run. It is a pretty good way to save time, but Atlassian have walked the extra mile to develop a plugin named FastDev, which can be used to reload plugin changes during development to all Atlassian applications including JIRA. And that, from the browser itself!

Getting ready

Create a plugin and use atlas-run to run the plugin as discussed in the aforementioned recipe. Let us assume we are doing it on the plugin we created in the previous recipe—the one with the sample Web Item. If we run this sample Web Item plugin, using atlas-run, we can access JIRA at port 2990 as mentioned earlier, and the Web Item will look as highlighted in the following screenshot:

As you can see, the J-Tricks link appears along with the Profile link under the personal section. But what if you wanted the link at the jira-help section, along with Online Help, About JIRA, and so on?

How to do it…

Following are the simple steps to make the aforementioned change to the plugin and reload it using FastDev:

  1. Access the FastDev servlet on the browser using the following path: http://localhost:2990/jira/plugins/servlet/fastdev

    You will find the servlet as shown in the following screenshot:

  2. Make the change to your plugin. In this example, the change is pretty small. All we do is modify the atlassian-plugin.xml file to change the section attribute in the web-item module from section="system.user.options/personal" to section="system.user.options/jira-help".

  3. Click on the Scan and Reload button on the servlet (shown in the previous screenshot). On clicking the button, FastDev will reload the plugin. You can track the progress and see the logs on the browser itself, as shown in the following screenshot:

  4. Once the plugin is successfully reloaded, you will see the following screenshot with a success message:

  5. Reload the JIRA page to see if the change is effective. In our example, the new screen will be as follows:

    As you can see, the J-Tricks link has moved to the help section.

    Note

    Using FastDev is very effective while building a plugin from scratch and testing it, as the pieces fall into the right places gradually.

How it works...

When the Scan and Reload button is clicked, FastDev looks for files that have changed since the last time a plugin was installed. If it detects any changes, it starts a Maven process that reinstalls the plugin.

There's more…

There is more to FastDev than the default configurations. They can be set in your plugin's pom.xml file by adding the required property to the systemPropertyVariables node. You will find the details in the Atlassian documentation (see the previous note box), but the most useful ones are mentioned later.

Adding ignored files

While looking for changes, FastDev ignores certain files such as .js or .css files that don't need a reinstall of the plugin. The following table shows the full list of files/directories that are ignored:

Type

Property name

Default(s)

Directory

fastdev.no.reload.directories

.svn

Extension

fastdev.no.reload.extensions

.js, .vm, .vmd, .fm, .ftl, .html, .png, .jpeg, .gif, .css

File

fastdev.no.reload.files

 –

If you want to ignore additional files or directories, you can add them using the preceding properties, shown as follows:

<systemPropertyVariables>
...
  <fastdev.no.reload.directories>
    images
  </fastdev.no.reload.directories>
  <fastdev.no.reload.extensions>
    classpath
  </fastdev.no.reload.extensions>
  <fastdev.no.reload.files>
    ${basedir}/src/main/resources/LICENSE.txt
  </fastdev.no.reload.files>
</systemPropertyVariables>

Changing admin credentials

FastDev uses the default admin/admin credential to reinstall the plugin. But if the username or password is different, use the fastdev.install.username and fastdev.install.password properties, shown as follows:

<systemPropertyVariables>
...
  <fastdev.install.username>myusername</fastdev.install.username>
  <fastdev.install.password>mypassword</fastdev.install.password>
</systemPropertyVariables>

See also

  • The Setting up the development environment recipe

  • The Creating a skeleton plugin recipe

  • The Making changes to and redeploying a plugin recipe