Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

JIRA Development Cookbook - Third Edition
JIRA Development Cookbook - Third Edition
JIRA Development Cookbook - Third Edition
Ebook1,303 pages5 hours

JIRA Development Cookbook - Third Edition

Rating: 0 out of 5 stars

()

Read preview

About this ebook

About This Book
  • Explore the new features of JIRA 7 and best practices for agile development and integration with development tools
  • Customize the look and feel of your JIRA UI to match your specific user needs
  • Create seamless reports that make sense of your data through easy-to-use techniques
Who This Book Is For

If you are a JIRA developer or administrator, or a project manager who wants to fully exploit the exciting capabilities of JIRA, then this is the perfect book for you.

LanguageEnglish
Release dateSep 30, 2016
ISBN9781785886331
JIRA Development Cookbook - Third Edition

Read more from Jobin Kuruvilla

Related to JIRA Development Cookbook - Third Edition

Related ebooks

Software Development & Engineering For You

View More

Related articles

Reviews for JIRA Development Cookbook - Third Edition

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    JIRA Development Cookbook - Third Edition - Jobin Kuruvilla

    Table of Contents

    JIRA Development Cookbook Third Edition

    Credits

    About the Author

    Acknowledgments

    About the Reviewer

    www.PacktPub.com

    Why subscribe?

    Preface

    What this book covers

    What you need for this book

    Who this book is for

    Sections

    Getting ready

    How to do it…

    How it works…

    There's more…

    See also

    Conventions

    Reader feedback

    Customer support

    Downloading the example code

    Errata

    Piracy

    Questions

    1. Plugin Development Process

    Introduction

    What is a JIRA add-on?

    The plugin development process

    Atlassian Marketplace

    Troubleshooting

    Setting up the development environment

    Getting ready

    How to do it...

    There's more...

    Proxy settings for Maven

    Using local Maven

    Configuring IDEs to use the SDK

    Troubleshooting

    Creating a skeleton plugin

    Getting ready

    How to do it...

    How it works...

    There's more...

    One step to your skeleton plugin

    Creating an Eclipse project

    Adding plugin modules

    Getting ready

    How to do it...

    How it works...

    Deploying a JIRA plugin

    Getting ready

    How to do it...

    How it works...

    There's more...

    Using a specific version of JIRA

    Reusing the data in each run

    Troubleshooting

    Making changes and redeploying a plugin

    How to do it...

    Debugging in Eclipse

    See also

    Using FastDev for plugin development

    Getting ready

    How to do it...

    How it works...

    There's more...

    Adding ignored files

    Changing admin credentials

    See also

    Testing and debugging

    Getting ready

    How to do it...

    How it works...

    There's more...

    Using custom data for integration/functional Tests

    Testing against different version of JIRA/Tomcat

    See also

    2. Understanding the Plugin Framework

    Introduction

    JIRA architecture

    Third-party components

    Webwork

    Seraph

    Embedded Crowd

    PropertySet

    Active Objects

    OSWorkflow

    OfBiz Entity Engine

    Apache Lucene

    Atlassian Gadget JavaScript Framework

    Shared Access Layer

    Architecture

    Authentication and user management

    Property management

    Presentation

    Database

    Workflows

    Searching

    Scheduled jobs

    Plugins

    Types of plugin modules

    Reporting

    Workflows

    Custom fields

    Searching

    Links and tabs

    Remote invocation

    Actions and components

    Other plugin modules

    What goes into atlassian-plugin.xml?

    Working with the Plugins1 and Plugins2 versions

    Development

    Installation

    JIRA system plugins

    Stable and core APIs

    Modifying Atlassian bundled plugins

    How to do it...

    How it works...

    See also

    Converting plugins from V1 to V2

    Getting ready

    How to do it...

    How it works...

    See also

    Adding resources into plugins

    Getting ready

    How to do it...

    Adding web resources into plugins

    How to do it...

    How it works...

    There's more...

    Web resource contexts

    Turning off batch mode

    Building JIRA from source

    Getting ready

    How to do it...

    How it works...

    There's more...

    Making a single class patch

    See also

    Adding new webwork actions to JIRA

    Getting ready

    How to do it...

    How it works...

    There's more...

    Adding new commands to the action

    See also

    Form token handling in webwork actions

    Getting ready

    How to do it...

    How it works...

    There's more...

    Providing a token in HTML links

    Getting the token programmatically

    Opting out of token checking in remote calls

    See also

    Capturing plugin installation/uninstallation events

    Getting ready

    How to do it...

    How it works...

    See also

    3. Working with Custom Fields

    Introduction

    Writing a simple custom field

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Custom field searchers

    Getting ready

    How to do it...

    How it works...

    There's more...

    Dealing with custom fields on an issue

    Getting ready

    How to do it...

    How it works...

    See also

    Programming custom field options

    Getting ready

    How to do it...

    See also

    Overriding the validation of custom fields

    Getting ready

    How to do it...

    See also

    Customizing the change log value

    Getting ready

    How to do it...

    How it works...

    Migrating from one custom field type to another

    How to do it...

    How it works...

    There's more...

    Changing the type of a custom field

    See also

    Making custom fields sortable

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Displaying custom fields on subtask columns

    How to do it...

    How it works...

    User and date fields

    How to do it...

    How it works...

    See also

    Adding custom fields to notification e-mails

    Getting ready

    How to do it...

    How it works...

    Adding help text for a custom field

    Getting ready

    How to do it...

    How it works...

    Removing the none option from a select field

    How to do it...

    There's more...

    Reloading velocity changes without restart (auto reloading)

    See also

    Making the custom field project importable

    How to do it...

    See also

    Changing the size of a text area custom field

    How to do it...

    See also

    4. Programming Workflows

    Introduction

    Writing a workflow condition

    Getting ready

    How to do it...

    How it works...

    See also

    Writing a workflow validator

    Getting ready

    How to do it...

    How it works...

    See also

    Writing a workflow post function

    Getting ready

    How to do it...

    How it works...

    See also

    Editing an active workflow

    How to do it...

    How it works...

    There's more...

    Modifying workflows in a JIRA database

    Permissions based on workflow status

    How to do it...

    How it works...

    There's more...

    Making an issue editable/non-editable using workflow properties

    See also

    Including/excluding resolutions for specific transitions

    How to do it...

    How it works...

    See also

    Adding workflow triggers

    Getting ready

    How to do it...

    How it works...

    There's more...

    User mapping from development tools to JIRA

    See also

    Internationalization in workflow statuses

    How to do it...

    How it works...

    See also

    Obtaining available workflow actions programmatically

    How to do it...

    How it works...

    There's more...

    Getting the action ID's given name

    Programmatically progressing on workflows

    How to do it...

    How it works...

    Obtaining workflow history from the database

    Getting ready

    How to do it...

    How it works...

    See also

    Reordering workflow actions in JIRA

    How to do it...

    How it works...

    Creating common transitions in workflows

    How to do it...

    How it works...

    Creating global transitions in workflows

    How to do it...

    How it works...

    5. Gadgets and Reporting in JIRA

    Introduction

    Writing a JIRA report

    Getting ready

    How to do it...

    How it works...

    See also

    Reports in Excel format

    Getting ready

    How to do it...

    How it works...

    See also

    Data validation in JIRA reports

    Getting ready

    How to do it...

    How it works...

    See also

    Restricting access to reports

    Getting ready

    How to do it...

    How it works...

    See also

    Object configurable parameters for reports

    How to do it...

    How it works...

    See also

    Writing JIRA gadgets

    Getting ready

    How to do it...

    How it works...

    There's more...

    Invoking REST services from gadgets

    Getting ready

    How to do it...

    How it works...

    See also

    Configuring user preferences in gadgets

    Getting ready...

    How to do it...

    How it works...

    There's more...

    See also

    Accessing gadgets outside of JIRA

    Getting ready...

    How to do it...

    How it works...

    See also

    6. The Power of JIRA Searching

    Introduction

    Writing a JQL function

    Getting ready

    How to do it...

    How it works...

    See also

    Sanitizing JQL functions

    Getting ready

    How to do it...

    How it works...

    See also

    Adding a search request view

    Getting ready

    How to do it...

    How it works...

    There's more...

    Using Single Issue Views to render search views

    See also

    Smart querying using quick search

    How to do it...

    There's more...

    Searching in plugins

    How to do it...

    There's more...

    See also

    Parsing a JQL query in plugins

    How to do it...

    How it works...

    See also

    Linking directly to search queries

    How to do it...

    How it works...

    There's more...

    Index and de-index issues programmatically

    How to do it...

    See also

    Searching on issue entity properties

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Managing filters programmatically

    How to do it...

    Creating a filter

    Updating a filter

    Deleting a filter

    Retrieving filters

    Sharing a filter

    See also

    Subscribing to a filter

    How to do it...

    How it works...

    There's more...

    See also

    7. Programming Issues

    Introduction

    Creating an issue from a plugin

    How to do it...

    How it works...

    There's more...

    Creating the issue using IssueManager

    See also

    Creating subtasks on an issue

    How to do it...

    See also

    Updating an issue

    How to do it...

    Deleting an issue

    How to do it...

    Adding new issue operations

    Getting ready

    How to do it...

    How it works...

    There's more...

    See also

    Conditions on issue operations

    Getting ready...

    How to do it...

    How it works...

    Working with attachments

    Getting ready...

    How to do it...

    Creating an attachment

    Reading attachments on an issue

    Deleting an attachment

    There's more...

    Time tracking and worklog management

    Getting ready...

    How to do it...

    Auto adjusting the remaining estimate

    Logging work and retaining the remaining estimate

    Logging work with a new remaining estimate

    Logging work and adjusting the remaining estimate by a value

    How it works...

    There's more

    Updating worklogs

    Deleting worklogs

    Auto Adjusting remaining estimate

    Deleting a worklog and retaining the remaining estimate

    Deleting a worklog with a new remaining estimate

    Deleting a worklog and adjusting the remaining estimate

    Working with comments on issues

    How to do it...

    Creating comments on issues

    Creating comments on an issue and restricting it to a project role or group

    Updating comments

    Deleting comments

    Programming change logs

    How to do it...

    How it works...

    Programming issue links

    Getting ready...

    How to do it...

    There's more...

    Deleting Issue Links

    Retrieving Issue Links on an issue

    JavaScript tricks on issue fields

    How to do it...

    How it works...

    Creating issues and comments from e-mail

    How to do it...

    How it works...

    8. Customizing the UI

    Introduction

    Changing the basic look and feel

    How to do it...

    Adding new web sections in the UI

    How to do it...

    How it works...

    See also

    Adding new web items in the UI

    How to do it...

    How it works...

    See also

    Use of decorators and other metadata tags

    Getting ready

    How to do it...

    How it works...

    See also

    Adding conditions for web fragments

    How to do it...

    How it works...

    Creating new velocity context for web fragments

    How to do it...

    How it works...

    Adding a new drop-down menu on the top navigation bar

    How to do it...

    How it works...

    Dynamic creation of web items

    Getting ready

    How to do it...

    How it works...

    Adding new tabs in the View Issue screen

    Getting ready

    How to do it…

    How it works...

    There's more...

    Loading issue tab panel asynchronously

    Adding new tabs in the Browse Project screen

    Getting ready

    How to do it...

    How it works...

    Adding new links in the Project-centric view

    Getting ready

    How to do it...

    How it works...

    See also

    Adding new panels in the project-centric view

    Getting ready

    How to do it...

    How it works...

    Adding sub-navigation in Project-centric view

    Getting ready

    How to do it...

    How it works...

    Adding issue link renderers

    Getting ready

    How to do it...

    How it works...

    See also

    Displaying dynamic notifications/warnings on issues

    Getting ready

    How to do it...

    There's more...

    Re-ordering Issue Operations in the View Issue page

    How to do it...

    How it works...

    See also

    Re-ordering fields in the View Issue page

    How to do it...

    See also

    9. Remote Access to JIRA

    Introduction

    Writing Java client for REST API

    Getting ready

    How to do it...

    Working with issues

    Getting ready

    How to do it...

    Creating Issues

    Updating issues

    Browsing issues

    Working with attachments

    Getting ready

    How to do it...

    Using input stream and a new filename

    Using the AttachmentInput object

    Using file and a new filename

    Browsing attachments

    Remote time tracking

    Getting ready...

    How to do it...

    Working with comments

    Getting ready

    How to do it...

    Remote user and group management

    How to do it...

    Creating a User

    Updating a User

    Adding a User to an application

    Removing a User from an application

    Deleting a User

    Creating a Group

    Adding a user to a Group

    Getting users in a Group

    Removing a user from a Group

    Deleting a Group

    Progressing an issue in workflow

    Getting ready

    How to do it...

    Searching issues

    Getting ready

    How to do it...

    Managing versions

    Getting ready

    How to do it...

    Managing components

    Getting ready

    How to do it...

    Remote administration methods

    How to do it...

    Creating a Permission Scheme

    Creating a Project

    Retrieving the project roles

    Add actors to a project role

    How it works...

    Exposing services and data entities as REST APIs

    Getting ready

    How to do it...

    How it works...

    Using the REST API browser

    How to do it...

    Working with JIRA Webhooks

    How to do it...

    How it works...

    There's more...

    10. Dealing with the JIRA Database

    Introduction

    Extending the JIRA database with a custom schema

    How to do it...

    How works...

    Accessing database entities from plugins

    How to do it...

    Reading from a database

    Writing a new record

    Updating a record

    Persisting plugin information in the JIRA database

    How to do it...

    How it works...

    Using Active Objects to store data

    Getting ready...

    How to do it...

    How it works...

    Accessing the JIRA configuration properties

    How to do it...

    Getting a database connection for JDBC calls

    How to do it...

    Migrating a custom field from one type to another

    How to do it...

    Retrieving issue information from a database

    How to do it...

    There's more...

    Retrieving custom field details from a database

    How to do it...

    Retrieving permissions on issues from a database

    How to do it...

    Retrieving workflow details from a database

    How to do it...

    Updating the issue status in a database

    Getting ready

    How to do it...

    Retrieving users and groups from a database

    How to do it...

    Dealing with change history in a database

    How to do it...

    11. Useful Recipes

    Introduction

    Writing a service in JIRA

    Getting ready

    How to do it...

    How it works...

    See also

    Adding configurable parameters to a service

    How to do it...

    How it works...

    See also

    Writing scheduled tasks in JIRA

    How to do it...

    How it works...

    See also

    Writing listeners in JIRA

    Getting ready

    How to do it...

    How it works...

    See also

    Customizing e-mail content

    How to do it...

    How it works...

    Redirecting to a different page in webwork actions

    How to do it...

    Adding custom behavior for user details

    Getting ready

    How to do it...

    How it works...

    Deploying a servlet in JIRA

    Getting ready

    How to do it...

    How it works...

    Adding shared parameters to Servlet Context

    Getting ready

    How to do it...

    How it works...

    Writing a Servlet Context Listener

    Getting ready

    How to do it...

    How it works...

    Using filters to intercept queries in JIRA

    Getting ready

    How to do it...

    How it works...

    Adding and importing components in JIRA

    Getting ready

    How to do it...

    Exposing components to other plugins

    Importing public components

    How it works...

    Adding new module types to JIRA

    Getting ready

    How to do it...

    Creating modules using the new module type

    Using the new modules

    How it works...

    Enabling access logs in JIRA

    How to do it...

    How it works...

    Enabling SQL logging in JIRA

    How to do it...

    How it works...

    Internationalization in webwork plugins

    How to do it...

    How it works...

    Sharing common libraries across v2 plugins

    Getting ready

    How to do it...

    Operations using direct HTML links

    How to do it...

    Implementing Marketplace licensing in plugins

    Getting ready

    How to do it...

    How it works...

    JIRA Development Cookbook Third Edition


    JIRA Development Cookbook Third Edition

    Copyright © 2016 Packt Publishing

    All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

    Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

    Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

    First published: September 2016

    Production reference: 1230916

    Published by Packt Publishing Ltd.

    Livery Place

    35 Livery Street

    Birmingham 

    B3 2PB, UK.

    ISBN 978-1-78588-561-7

    www.packtpub.com

    Credits

    About the Author

    Jobin Kuruvilla is an Atlassian Consultant with experience in customizing JIRA and writing JIRA plugins for various customers. He is currently working with Go2Group as an Atlassian platinum expert, and is involved in managing Atlassian products for big enterprises as well as small starter license installations. From an IT nerd to a DevOps evangelist, Jobin has performed various roles in his professional journey so far.

    Jobin is the author of JIRA Development Cookbook, released in 2011, and JIRA 5.x Development Cookbook, released in 2013, both published by Packt Publishing and well-received in the JIRA community. He also runs a website named J-Tricks (http://www.j-tricks.com), using which he shares numerous tutorials to help the developer community, who he believes have contributed immensely to his personal development. It is indeed those tutorials that sowed the first seeds of JIRA Development Cookbook.

    Jobin started his career as a Java/J2EE developer in one of the biggest IT companies in India. After spending his initial years in the SOA world, he got hooked into this amazing product called JIRA, which he came across during the evaluation of a number of third-party tools. Soon, Jobin realized the power of JIRA, and pledged to spread the word. He has been doing it ever since, and he reckons there is a long way to go!

    Outside the office, Jobin enjoys sports, especially soccer, and is on the verge of getting addicted to movies and social networking sites.

    Acknowledgments

    No book is the product of just the author; he just happens to be the one with his name on the cover.

    A number of people contributed to the success of this book, and it would take more space than I have to thank each one individually.

    First of all, thanks to the Almighty God for helping me to sail through the difficulties in this short life and for making my life as wonderful as it is now.

    The next biggest thanks goes to the Content Development Editor, Samantha Gonsalves, and Acquisition Editor, Prachi Bisht, both of whom went through the pain of making me write another book. Also, a big shout-out to Anushree Tendulkar, the Technical Editor, who worked tirelessly to make the book as readable as it is now. And to the entire Packt Publishing team for working so diligently to help bring out another high quality product.

    It is amazing to work with talented developers and technical geeks. Thank you to all the intelligent minds, with whom I got a chance to share this amazing journey of programming. Your encouragement and support were/are invaluable to me; you guys rock!

    I must also thank the talented Atlassian community who are instrumental in helping each other, sharing solutions, being active in the forums, running user groups, and whatnot. I am just one of the many who have benefited.

    Before I wind up, thank you Atlassian for giving us JIRA and a set of other wonderful products. You don't realize how much you are making our lives easier. Go Team!

    Last, but not the least, a big thanks to all at Go2group for the support extended in writing this book and believing in my capabilities. We will, together, continue to simplify complexities for our numerous customers.

    About the Reviewer

    Satyendra Gangadhar Narwane describes himself as someone who is honest, caring, intelligent, hardworking, and ambitious. He has a great sense of humor. He is a post-graduate with masters in computer science from one of the premier Indian university and working as a Sr. Atlassian product expert in Dynamic Network Factory (U.S.A.), he has conducted seminar on behalf of Atlassian for promoting their tools in India, He has developed dozens of custom add-on based on customer needs. He has providing training, administrating & add-on development on Atlassian suite for top companies such as Oracle, Adobe, HCL,Mercedes Benz, MillenniumIT, Filpkart, ShipNet NS, KBC Bank. He is passionate about technology, computers science, traveling, watching movies and enjoy great chats. He has also worked on Jira 7 Development Cookbook.

    I would like to express my gratitude to the many people who help me through this book. I would like to thank Packt for giving me a chance to work on this book. Above all I want to thank my mom Sushila, wife Poonam and the rest of my family, who supported and encouraged me in spite of all the time it took me away from them. It was a long and difficult journey for them. I would like to thank Suzanne Coutinho, Chaitanya Nair for helping me in the process of selection and reviewing. Last and not least: I beg forgiveness of all those who have been with me over the course of the years and whose names I have failed to mention."

    www.PacktPub.com

    For support files and downloads related to your book, please visit www.PacktPub.com.

    Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.

    At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

    https://www2.packtpub.com/books/subscription/packtlib

    Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

    Why subscribe?

    Fully searchable across every book published by Packt

    Copy and paste, print, and bookmark content

    On demand and accessible via a web browser

    My parents, Alice and Kuruvilla, who found something in me that I never knew existed. Nothing beats the pain and suffering they have undergone in the process.

    My wife Anumol, my best friend for years. I wouldn't be in this place if not for her unconditional love and care.

    My little princesses, Elsa & Anna. Err, I mean ANNA & SARAH!

    My sister, Juby Sara, the best sister in the world. And to her husband, Davis, & son, Kuttoos, for keeping her happy. You both are doing a much better job than me ;)

    My friends from TKM and JNV Kottayam who dared me to dream and then helped me to achieve them. You guys are the best.

    A friend in need....

    Enough said!

    This book would not have been possible without your love and understanding.

    A big thank you from the bottom of my heart. I have nothing to give back, but my love and prayers.

    Preface

    This book is your one-stop resource for mastering JIRA extension and customization. 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.

    The book 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. After that, we will learn how to program and customize workflows to transform JIRA into a user-friendly system. We will follow this by looking at customizing the various searching aspects of JIRA, such as JQL, searching in plugins, and managing filters.

    The book then steers towards programming issues, that is, creating/editing/deleting issues, creating new issue operations, managing the various other operations available on issues using the JIRA APIs, and so on. In the subsequent chapters, you will learn how to customize JIRA by adding new tabs, menus, and web items; communicate with JIRA using the REST interface; and work with the JIRA database.

    The book ends with a chapter on useful and general JIRA recipes.

    What this book covers

    Chapter 1, Plugin Development Process , covers the fundamentals of the JIRA plugin development process. It covers in detail the setting up of a development environment, creating a plugin, deploying it, and testing it.

    Chapter 2 , Understanding Plugin Framework , covers in detail the JIRA architecture and looks at the various plugin points. It also looks at how to build JIRA from source and extend or override existing JIRA functionalities.

    Chapter 3 , Working with Custom Fields , looks at programmatically creating custom fields in JIRA, writing custom field searchers, and various other useful recipes related to custom fields.

    Chapter 4 , Programming Workflows , looks at the various ways of programming JIRA workflows. It includes writing new conditions, validators, post functions, and so on and contains related recipes that are useful in extending workflows.

    Chapter 5 ,  Gadgets and Reporting in JIRA , covers the reporting capabilities of JIRA. It looks at writing reports and dashboard gadgets, among others, in detail.

    Chapter 6 , The Power of JIRA Searching , covers the searching capabilities of JIRA and how it can be extended using the JIRA APIs.

    Chapter 7 , Programming Issues , looks at the various APIs and methods used for managing issues programmatically. It covers the CRUD operations, working with attachments, programming change logs and issue links, and time tracking among others.

    Chapter 8 , Customizing the UI , looks at the various ways of extending and modifying the JIRA user interface.

    Chapter 9 , Remote Access to JIRA , looks at the REST APIs that enable remote communication with JIRA and the ways of extending them.

    Chapter 10 , Dealing with the Database , looks at the database architecture of JIRA and covers the major tables in detail. It also covers the different ways of extending storage and accessing or modifying data using plugins.

    Chapter 11 , Useful Recipes , covers a selected list of useful recipes, which do not belong in the preceding categories but are powerful enough to get your attention. Read away!

    What you need for this book

    This book focuses on JIRA development. You need the following software as a bare minimum:

    JIRA 7.x+

    JAVA 1.8

    Maven 3.x

    Atlassian Plugin SDK 6.x+

    An IDE of your choice. The examples in the book use Eclipse.

    A database supported by JIRA. The examples in the book use H2DB, which comes with standalone JIRA.

    Some of the recipes are too simple to use the fully fledged plugin-development process, and you will see this highlighted as you read through the book!

    Who this book is for

    JIRA Development Cookbook, Third Edition is intended for administrators that will be customizing, supporting and maintaining JIRA for their organizations.

    You will need to be familiar and have a good understanding of JIRA's core concepts. For some recipes, basic understanding in HTML, CSS, JavaScript, and basic programming knowledge will also be helpful.

    Sections

    In this book, you will find several headings that appear frequently (Getting ready, How to do it, How it works, There's more, and See also).

    To give clear instructions on how to complete a recipe, we use these sections as follows:

    Getting ready

    This section tells you what to expect in the recipe, and describes how to set up any software or any preliminary settings required for the recipe.

    How to do it…

    This section contains the steps required to follow the recipe.

    How it works…

    This section usually consists of a detailed explanation of what happened in the previous section.

    There's more…

    This section consists of additional information about the recipe in order to make the reader more knowledgeable about the recipe.

    See also

    This section provides helpful links to other useful information for the recipe.

    Conventions

    In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

    Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: Definitely not! JIRA itself provides a lot of customization options through its user interface, and in more demanding cases, using property files like jira-config.properties.

    A block of code is set as follows:

        …

       

           

                true

                http

                proxy.demo.com

                8080

                demouser

                demopassword

               localhost|*.demosite.com

           

       

        …

    New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: You can just import the project using the option File | Import | Existing Maven Projects, and select the relevant project

    Note

    Warnings or important notes appear in a box like this.

    Tip

    Tips and tricks appear like this.

    Reader feedback

    Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

    To send us general feedback, simply e-mail feedback@packtpub.com, and mention the book's title in the subject of your message.

    If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors .

    Customer support

    Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

    Downloading the example code

    You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

    You can download the code files by following these steps:

    Log in or register to our website using your e-mail address and password.

    Hover the mouse pointer on the SUPPORT tab at the top.

    Click on Code Downloads & Errata.

    Enter the name of the book in the Search box.

    Select the book for which you're looking to download the code files.

    Choose from the drop-down menu where you purchased this book from.

    Click on Code Download.

    You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged in to your Packt account.

    Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

    WinRAR / 7-Zip for Windows

    Zipeg / iZip / UnRarX for Mac

    7-Zip / PeaZip for Linux

    The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/JIRA-Development-Cookbook-Third-Edition. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

    Errata

    Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

    To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

    Piracy

    Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

    Please contact us at copyright@packtpub.com with a link to the suspected pirated material.

    We appreciate your help in protecting our authors and our ability to bring you valuable content.

    Questions

    If you have a problem with any aspect of this book, you can contact us at questions@packtpub.com, and we will do our best to address the problem.

    Chapter 1. Plugin Development Process

    In this chapter, we will cover the following topics:

    Setting up the development environment

    Creating a skeleton plugin

    Adding plugin modules

    Deploying a JIRA plugin

    Making changes and redeploying a plugin

    Using FastDev for plugin development

    Testing and debugging

    Introduction

    Atlassian JIRA, as we all know, is primarily an issue tracking and project management system. Since version 7.0, JIRA also comes in different flavors, namely JIRA Core, JIRA Software, and JIRA Service Desk,each packaged to cater to the needs of its various user categories. JIRA Core focuses on business teams, JIRA software on software teams and JIRA service desk on IT and service teams.

    What many people do not know, though, is the power of its numerous customization capabilities, using which we can turn it into a different system altogether, much more powerful than these prepackaged flavors! These extra capabilities can take JIRA to the next level, in addition to its core issue tracking and project tracking capabilities for which JIRA, arguably, is the best player in the market.

    So what are these customizations? How can we convert the JIRA we know into a product we want? Or maybe just add extra functionalities that are specific to our organization?

    The answer to these questions probably can be summarized in a single word,add-ons, also referred to as plugins. JIRA has given the power to its users to write add-ons and customize the functionality in a way they find suitable.

    But is that the only way? Definitely not! JIRA itself provides a lot of customization options through its user interface, and in more demanding cases, using property files such as jira-config.properties. In some cases, you will also find yourself modifying some of the JIRA core files to tweak functionality or to work around a problem. We will see more of that in the chapters to come, but the best entry point to JIRA customizations is add-ons. And that is where we start our cookbook, before we move on to the in-depth details.

    What is a JIRA add-on?

    So, what is a JIRA add-on? JIRA itself is a web application written in Java. But that doesn't mean you need to know Java to write an add-on, though in most cases you will need to. You might also end up writing a simple descriptor file to add a few links here and there. If that makes the non-Java developer in you happy, watch out for the different plugin modules JIRA supports.

    There are two frameworks for writing JIRA add-ons: Atlassian Connect and the Plugins2 framework.

    Atlassian Connect add-ons are essentially web applications that operate remotely over HTTP. But they run only on Atlassian Cloud and are well documented at https://developer.atlassian.com/static/connect/docs/latest/guides/introduction.html, hence they are outside the scope of this book.

    A Plugins2 plugin is a JAR file that has a mandatory plugin descriptor and some optional Java classes and velocity templates. The velocity templates are used to render the HTML pages associated with your plugin, but in some cases, you might also want to introduce JSPs to make use of some pre-existing templates in JIRA. JSPs, as opposed to velocity templates, cannot be embedded in the plugin, but instead they should be dropped into the appropriate folders in the JIRA web application. Hence using velocity templates is recommended over JSPs. You can find more details on writing velocity templates at http://velocity.apache.org/engine/1.7/user-guide.html#velocity-template-language-vtl-an-introduction.

    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:

    Developing the plugin.

    Deploying it into local JIRA.

    Testing the plugin functionality.

    Making changes and redeploying 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,

    Enjoying the preview?
    Page 1 of 1