JIRA 5.x Development Cookbook
()
About this ebook
Read more from Jobin Kuruvilla
JIRA Development Cookbook - Third Edition Rating: 0 out of 5 stars0 ratingsJIRA Development Cookbook Rating: 0 out of 5 stars0 ratings
Related to JIRA 5.x Development Cookbook
Related ebooks
Oracle JDeveloper 11gR2 Cookbook Rating: 0 out of 5 stars0 ratingsMicrosoft System Center 2016 Service Manager Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsMicrosoft System Center 2012 Service Manager Cookbook Rating: 0 out of 5 stars0 ratingsWeb Development with Django Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsYii2 Application Development Cookbook - Third Edition Rating: 0 out of 5 stars0 ratingsMicrosoft System Center 2012 Configuration Manager: Administration Cookbook Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics NAV 7 Programming Cookbook Rating: 0 out of 5 stars0 ratingsOdoo Development Cookbook Rating: 0 out of 5 stars0 ratingsMeteor Cookbook Rating: 5 out of 5 stars5/5Visualforce Development Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsEntity Framework Core Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsVMware vRealize Orchestrator Cookbook Rating: 0 out of 5 stars0 ratingsBusiness Intelligence with MicroStrategy Cookbook Rating: 0 out of 5 stars0 ratingsYii Application Development Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsJIRA 6.x Administration Cookbook Rating: 0 out of 5 stars0 ratingsJIRA 7 Administration Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsManaging Data and Media in Silverlight 4: A mashup of chapters from Packt's bestselling Silverlight books Rating: 0 out of 5 stars0 ratingsOracle Database 12c Security Cookbook Rating: 0 out of 5 stars0 ratingsDart Cookbook Rating: 0 out of 5 stars0 ratingsLiferay 6.x Portal Enterprise Intranets Cookbook Rating: 0 out of 5 stars0 ratingsYii 1.1 Application Development Cookbook Rating: 0 out of 5 stars0 ratingsOracle APEX Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics NAV 2009 Programming Cookbook Rating: 0 out of 5 stars0 ratingswxPython Application Development Cookbook Rating: 0 out of 5 stars0 ratingsMicrosoft Azure Development Cookbook Second Edition Rating: 5 out of 5 stars5/5Microsoft Dynamics GP 2010 Cookbook Rating: 5 out of 5 stars5/5CMS Made Simple Development Cookbook Rating: 0 out of 5 stars0 ratingsSpring Roo 1.1 Cookbook Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics GP 2013 Cookbook Rating: 0 out of 5 stars0 ratingsMicrosoft Dynamics CRM 2011 Scripting Cookbook Rating: 0 out of 5 stars0 ratings
Enterprise Applications For You
Learn Windows PowerShell in a Month of Lunches Rating: 0 out of 5 stars0 ratingsCreating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Notion for Beginners: Notion for Work, Play, and Productivity Rating: 4 out of 5 stars4/5Agile Project Management: Scrum for Beginners Rating: 4 out of 5 stars4/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Excel Formulas and Functions 2020: Excel Academy, #1 Rating: 4 out of 5 stars4/5Excel Formulas That Automate Tasks You No Longer Have Time For Rating: 5 out of 5 stars5/5Enterprise AI For Dummies Rating: 3 out of 5 stars3/550 Useful Excel Functions: Excel Essentials, #3 Rating: 5 out of 5 stars5/5Excel 2019 Bible Rating: 4 out of 5 stars4/5Excel 2019 For Dummies Rating: 3 out of 5 stars3/5Learning Python Rating: 5 out of 5 stars5/5Excel : The Complete Ultimate Comprehensive Step-By-Step Guide To Learn Excel Programming Rating: 0 out of 5 stars0 ratingsCreate Income through Self-Publishing: An Author's Approach on Generating Wealth by Self-Publishing Rating: 5 out of 5 stars5/5101 Ready-to-Use Excel Formulas Rating: 4 out of 5 stars4/5Bitcoin For Dummies Rating: 4 out of 5 stars4/5Excel Tips and Tricks Rating: 0 out of 5 stars0 ratingsThe New Email Revolution: Save Time, Make Money, and Write Emails People Actually Want to Read! Rating: 5 out of 5 stars5/5Essential Office 365 Third Edition: The Illustrated Guide to Using Microsoft Office Rating: 3 out of 5 stars3/5The Basics of Hacking and Penetration Testing: Ethical Hacking and Penetration Testing Made Easy Rating: 4 out of 5 stars4/5ChatGPT Ultimate User Guide - How to Make Money Online Faster and More Precise Using AI Technology Rating: 0 out of 5 stars0 ratingsScrivener For Dummies Rating: 4 out of 5 stars4/5QuickBooks Online For Dummies Rating: 0 out of 5 stars0 ratingsThe Ridiculously Simple Guide To Numbers For Mac Rating: 0 out of 5 stars0 ratingsExperts' Guide to OneNote Rating: 5 out of 5 stars5/5
Reviews for JIRA 5.x Development Cookbook
0 ratings0 reviews
Book preview
JIRA 5.x Development Cookbook - Jobin Kuruvilla
Table of Contents
JIRA 5.x Development Cookbook
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Instant Updates on New Packt Books
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Plugin Development Process
Introduction
What is a JIRA plugin?
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
See also
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
See also
Adding plugin modules
Getting ready
How to do it…
How it works…
See also
Deploying a JIRA plugin
Getting ready
How to do it…
How it works…
There's more…
Using a specific version of JIRA
Re-using the configurations in each run
Troubleshooting
Making changes to and redeploying a plugin
How to do it…
There's more…
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 versions of JIRA/Tomcat
See also
2. Understanding the Plugin Framework
Introduction
JIRA architecture
Third-party components
Webwork
Seraph
OSUser
Embedded Crowd
PropertySet
Active Objects
OSWorkflow
OFBiz Entity Engine
Apache Lucene
Atlassian Gadget JavaScript Framework
Quartz
Architecture explained
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
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
See also
Building JIRA from source
Getting ready
How to do it…
How it works…
There's more…
Building JIRA dependencies
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
Extending a webwork action in JIRA
How to do it…
How it works…
See also
Capturing plugin installation/uninstallation events
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…
Programming custom field options
Getting ready
How to do it…
See also
Overriding 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 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 the JIRA database
Making an issue editable/non-editable based on workflow status
How to do it…
How it works…
See also
Including/excluding resolutions for specific transitions
How to do it…
How it works…
Permissions based on workflow status
How to do it…
How it works…
See also
Internationalization in workflow transitions
How to do it…
How it works…
Obtaining available workflow actions programmatically
How to do it…
How it works…
There's more...
Getting the action IDs, given the 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…
Jelly escalation
Getting ready
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 an 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
Creating a pie chart in JIRA
Getting ready
How to do it...
How it works...
There's more...
See also
Writing JIRA 4 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
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…
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 JQL queries 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 programmatically
How to do it…
See also
Managing filters programmatically
How to do it...
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...
Using IssueManager to create the issue
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 the 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
Discarding fields while cloning
Getting ready...
How to do it...
How it works...
See also
JavaScript tricks on issue fields
How to do it...
How it works...
Creating issues and comments from an 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
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...
Creating the project tab panel using fragments
How to do it...
How it works...
Adding new tabs in the Browse Version screen
Getting ready
How to do it...
How it works...
Adding new tabs in the Browse Component screen
Getting ready
How to do it...
How it works...
Adding issue link renderers
Getting ready
How to do it...
How it works...
See also
Extending a webwork action to add UI elements
Getting ready
How to do it...
How it works...
See also
Displaying dynamic notifications/warnings on issues
Getting ready
How to do it...
How it works...
See also
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...
There's more…
Wrapping custom fields in a separate module
See also
9. Remote Access to JIRA
Introduction
Writing a Java client for the REST API
Getting ready
How to do it...
Creating a SOAP client
Getting ready
How to do it...
Writing a Java XML-RPC client
Getting ready
How to do it...
Working with issues
Getting ready
How to do it...
Working with attachments
Getting ready
How to do it...
Using the input stream and a new filename
Using AttachmentInput
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
Getting ready
How to do it...
Progressing an issue in a workflow
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
Getting ready
How to do it...
How it works...
Exposing services and data entities as REST APIs
Getting ready
How to do it...
How it works...
Deploying a SOAP service in JIRA
Getting ready
How to do it...
How it works...
Deploying an XML-RPC service within JIRA
Getting ready
How to do it...
How it works...
See also
10. Dealing with the JIRA Database
Introduction
Extending the JIRA database with a custom schema
How to do it...
How it 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...
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...
There's more...
Writing listeners in JIRA
Getting ready
How to do it...
How it works...
There's more...
Handling, enabling, and disabling of plugins
Customizing e-mail content
How to do it...
How it works...
There's more...
Advanced customization—adding custom field information
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 the 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
Using service properties in 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 created
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...
Overriding JIRA's default components in plugins
Getting ready
How to do it...
How it works...
There's more...
Overriding by modifying the JIRA code
Internationalization in webwork plugins
How to do it...
Sharing common libraries across v2 plugins
Getting ready
How to do it...
Operations using direct HTML links
How to do it...
Index
JIRA 5.x Development Cookbook
JIRA 5.x Development Cookbook
Copyright © 2013 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: April 2013
Production Reference: 1180413
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78216-908-6
www.packtpub.com
Cover Image by Suresh Mogre (<suresh.mogre.99@gmail.com>)
Credits
Author
Jobin Kuruvilla
Reviewers
Felix Martineau
Mizan Ali Sayed
Acquisition Editor
Kevin Colaco
Lead Technical Editor
Sruthi Kutty
Technical Editors
Dominic Pereira
Kirti Pujari
Mameet Singh Vasir
Hardik B. Soni
Project Coordinator
Hardik Patel
Proofreaders
Maria Gould
Paul Hindle
Aaron Nash
Indexer
Rekha Nair
Graphics
Abhinash Sahu
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta
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.
Jobin is the author of JIRA Development Cookbook, Packt Publishing, released in 2011, which is a well-received book 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!
Acknowledgement
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 Project Coordinator, Hardik Patel, and Lead Technical Editor, Sruthi Kutty, both of whom went through the pain of making me write another book. Also, thanks to the entire Packt Publishing team for working so diligently to help bring out another high quality product.
It is amazing to work with a team of talented developers and technical geeks. Thank you STORM team, PD&B team, and RAMP team. Your encouragement and support were invaluable to me; you guys rock!
I must also thank the talented JIRA community who are instrumental in helping each other, sharing solutions, being active in the forums, running user groups, and what not? 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!
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.
About the Reviewers
Felix Martineau runs the Atlassian practice at TechSolCom (http://www.techsolcom.ca) and has been working as a professional JIRA consultant since 2008. Having started with JIRA in 2007, over the years he has worked with the entire Atlassian portfolio. Felix has a rare blend of technical expertise, people skills, and business acumen. For Felix, the people are always more important than the tools.
I want to thank the people at Packt Publishing for giving me this opportunity to review the book. Jobin Kuruvilla is one of the top people in the JIRA community, so it's an honor for me to be involved.
I would also like to thank my girlfriend Genevieve for her continuous support, as well as Paul Gamache and Jean Perron at TechSolCom, to whom I owe a lot professionally.
Mizan Ali Sayed is a Master in Computer Science from Pune university, India. Mizan currently works as an Atlassian tools specialist and has experience with implementing, customizing, and supporting large scale enterprise JIRA. He is active within the Atlassian forum Answers
and has published open source add-ons on the Atlassian Marketplace.
I would like to thank my parents and friends for their continuous support and encouragement.
www.PacktPub.com
Support files, eBooks, discount offers and more
You might want to visit www.PacktPub.com for support files and downloads related to your book.
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
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.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across 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 web browser
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Instant Updates on New Packt Books
Get notified! Find out when new books are published by following @PacktEnterprise on Twitter, or the Packt Enterprise Facebook page.
This book is dedicated to Sarah, Anna, Anu, Juby, Alice, and Kuruvilla. Also, my friends from TKM and JNV Kottayam.
This book would not have been possible without you, one way or the other!
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 for mastering 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.
We will then look at customizing the various searching aspects of JIRA such as JQL, searching in plugins, managing filters, and so on.
Then the book 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 latter half of the book, you will learn how to customize JIRA by adding new tabs, menus, and web items, and communicate with JIRA using the REST, SOAP, or XML/RPC interfaces, as well as working 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 the Plugin Framework, covers, in detail, the JIRA architecture, and also looks at the various plugin points. It also looks at how to build JIRA from source and extend or override the 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 the JIRA workflows. It includes writing new conditions, validators, post functions, and so on, and contains related recipes that are useful in extending the workflows.
Chapter 5, Gadgets and Reporting in JIRA, covers the reporting capabilities of JIRA. It looks at writing reports, dashboard gadgets, and much more 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 the change logs and issue links, time tracking, and much more.
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 remote capabilities of JIRA—REST, SOAP, and XML/RPC—and the ways of extending them.
Chapter 10, Dealing with the JIRA Database, looks at the database architecture of JIRA and covers the major tables in detail. It also covers the different ways to extend the storage and access or modify the data from 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 5.x+
JAVA 1.6+
Maven 2.x
Atlassian Plugin SDK
An IDE of your choice. The examples in the book use Eclipse and SQL Developer.
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
If you are a JIRA developer or a project manager who wants to fully exploit the exciting capabilities of JIRA, then this is the perfect book for you.
Conventions
In this book, you will find a number of styles of text 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: To use this, edit the settings.xml file under M2_HOME/conf/ by modifying the localRepository attribute to point to the embedded repository folder.
A block of code is set as follows:
.
.
Any command-line input or output is written as follows:
select id from changegroup where issueid = '10010'
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: That is, you can just import the project using the File | Import | Existing Maven Projects option, and selecting 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 may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <feedback@packtpub.com>, and mention the book title via 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 on 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 all Packt books you have purchased 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.
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 would 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 on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright 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
You can contact us at <questions@packtpub.com> if you are having a problem with any aspect of the book, and we will do our best to address it.
Chapter 1. Plugin Development Process
In this chapter, we will cover:
Setting up the development environment
Creating a skeleton plugin
Adding plugin modules
Deploying a JIRA plugin
Making changes to 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 tracking system. 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! Maybe a help desk system, a user story management system, an online approval process, and a lot more. This is in addition to the 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: plugins. JIRA has given the power to its users to write plugins 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 through plugins, and that is where we start our cookbook before we move on to the in-depth details.
What is a JIRA plugin?
So, what is a JIRA plugin? JIRA itself is a web application written in Java. That doesn't mean you need to know Java to write a plugin, though in most cases you will need to. You might 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.
A JIRA 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. Using Velocity templates is therefore recommended over JSPs.
Note
You can find more details on writing Velocity templates at http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html#velocity_template_language_vtl:_an_introduction.
The plugin descriptor, the only mandatory part of a plugin, is an XML file that 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. 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 steps 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:
Demo Plugin
plugins-version=2
>
http://www.j-tricks.com
/>
. . . 1 or more plugin modules . . .
The plugin, as you can see from the preceding sample, 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:
My Demo Report
....>
..
The plugin key in the preceding case will be com.jtricks.demo, and the complete 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 Marketplace to see if someone else has already done the dirty work for you!
Atlassian Marketplace
Atlassian Marketplace is a one-stop shop where you can find the entire list of commercial and open source plugins that people around the world have written. See https://marketplace.atlassian.com/plugins/app/jira for more details.
Troubleshooting
A common scenario that people encounter while deploying a 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 your