Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
JIRA Development Cookbook

You're reading from   JIRA Development Cookbook Develop and customize plugins, program workflows, work on custom fields, master JQL functions, and more to effectively customize, manage, and extend JIRA

Arrow left icon
Product type Paperback
Published in Nov 2011
Publisher Packt
ISBN-13 9781849681803
Length 476 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Jobin Kuruvilla Jobin Kuruvilla
Author Profile Icon Jobin Kuruvilla
Jobin Kuruvilla
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

JIRA Development Cookbook
Credits
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Preface
1. Plugin Development Process FREE CHAPTER 2. Understanding Plugin Framework 3. Working with Custom Fields 4. Programming Workflows 5. Gadgets and Reporting in JIRA 6. The Power of JIRA Searching 7. Programming Issues 8. Customizing the UI 9. Remote Access to JIRA 10. Dealing with a Database 11. Useful Recipes Index

Setting up the development environment


Now that we know what a plugin is, let 's aim at writing one! The first step in writing a JIRA plugin is to set up your environment, if you haven't done that already. In this recipe, we will see how to set up a local environment.

To make plugin development easier, Atlassian provides the Atlassian Plugin Software Development Kit (SDK). It comes along with Maven and a pre-configured settings.xml to make things easier.

Atlassian Plugin SDK can be used to develop plugins for other Atlassian products, including Confluence, Crowd, and so on, but we are concentrating only on JIRA.

Getting ready

The following are the pre-requisites for running the Atlassian plugin SDK:

  • The default port for the SDK: 2990 should be available. This is important because different ports are reserved for different Atlassian products.

  • JDK Java version 1.5 - 6 must be installed.

  • Make sure JAVA_HOME is set properly and the command java –version outputs the correct Java version details.

  • And of course, JIRA 4.x+ should be installed in your development environment.

    Note

    Make sure you use a context path for your JIRA because there are known issues with the SDK not working when the context path is empty. See https://studio.atlassian.com/browse/AMPS-122 for more details.

How to do it...

  1. Once we have Java installed and the port ready, we can download the latest version of Atlassian Plugin SDK from https://maven.atlassian.com/content/repositories/atlassian-public/com/atlassian/amps/atlassian-plugin-sdk/.

  2. Unzip the version into a directory of your choice. Let's call this directory SDK_HOME going forward.

  3. Add the SDK's bin directory into the environment PATH variable.

  4. Create a new environment variable M2_HOME pointing to the Apache-Maven directory in your SDK Home.

  5. A lot of commonly used dependencies are already available in the repository folder embedded in the SDK. To use this, edit the settings.xml under M2_HOME/conf/ and modify the localRepository attribute to point to the embedded repository folder. By default, it will use the USER_HOME/.m2/repository.

  6. Install the IDE of your choice. Atlassian recommends Eclipse, IntelliJ IDEA, or NetBeans, as they all support Maven.

  7. Ready, Set, Go…

How it works...

With these steps executed properly, we have a development environment for JIRA plugins.

The next step is to create a Skeleton plugin, import it into your IDE, and start writing some code! Creating the Skeleton plugin, deploying it, and so on, is explained in detail in the following recipes.

There's more...

Even though the aforementioned steps will work in most cases, we will come across scenarios where the setting up of the development environment is not that straightforward. For example, there are extra settings needed for Maven if the machine is behind a firewall. You might even have a local Maven version already installed. In this section, we will see some useful tips on similar cases.

Proxy settings for Maven

If you are behind a firewall, make sure you configure the proxy in the Maven settings.xml file. The proxy can be configured as follows:

<settings>
  .
  <proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.demo.com</host>
      <port>8080</port>
      <username>demouser</username>
      <password>demopassword</password>
      <nonProxyHosts>localhost|*.demosite.com</nonProxyHosts>
    </proxy>
  </proxies>
  .
</settings>

Find out more about that and other aspects of Maven at http://maven.apache.org/index.html.

Using local Maven

If you are a developer, in many cases you will have Maven already installed in your local machine. In that case, point M2_HOME to your local Maven and update the respective settings.xml with the repository details in the default settings.xml that ships with Atlassian plugin SDK.

Configuring IDEs to use SDK

If you are using IntelliJ IDEA, it is an easy job because IDEA integrated Maven out-of-the-box. Just load the project by selecting the pom.xml!

If you are using Eclipse, make sure you have M2Eclipse installed. This is because Eclipse integrates Maven through the Sonatype M2Eclipse plugin. You can find more details on configuring this at http://confluence.atlassian.com/display/DEVNET/Configuring+Eclipse+to+use+the+SDK.

Troubleshooting

If you see Maven download errors like Could not resolve artifact, make sure you verify the following:

  • Entry in Maven settings.xml is correct. That is, it points to the correct repositories

  • Proxy configuration is done if required

  • Antivirus in the local machine is disabled if none of the above works! Seriously, it makes a difference.

See also

  • Creating a skeleton plugin

You have been reading a chapter from
JIRA Development Cookbook
Published in: Nov 2011
Publisher: Packt
ISBN-13: 9781849681803
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image