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 5.x Development Cookbook

You're reading from   JIRA 5.x Development Cookbook This book is your one-stop resource for mastering JIRA extensions and customizations

Arrow left icon
Product type Paperback
Published in Apr 2013
Publisher Packt
ISBN-13 9781782169086
Length 512 pages
Edition 1st Edition
Tools
Arrow right icon
Toc

Table of Contents (19) Chapters Close

JIRA 5.x Development Cookbook
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
1. Plugin Development Process 2. Understanding the Plugin Framework FREE CHAPTER 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 the JIRA 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 our plugin development easier, Atlassian provides the Atlassian plugin software development kit (SDK). It comes along with Maven and a preconfigured settings.xml file to make things easier.

The 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

Following are the prerequisites for running the Atlassian plugin SDK:

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

  • JDK should be installed and Java version 1.6.x is required.

    Note

    The SDK is not yet compatible with Java 1.7.

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

How to do it…

Following are the steps to set up our development environment:

  1. Once we have installed Java and the port 2990 is ready, we can download the latest version of Atlassian plugin SDK from https://developer.atlassian.com/display/DOCS/Getting+Started.

  2. Install the SDK by following the instructions provided on the Atlassian Developer Documentation page, depending upon the operating system. Let's call this directory SDK_HOME.

  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/atlassian-plugin-sdk directory.

    Note

    SDK version 4.x and above doesn't need this step.

  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 file under M2_HOME/conf/ by modifying the localRepository attribute to point to the embedded repository folder. By default, it will use the USER_HOME/.m2/repository directory.

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

With the preceding steps executed properly, we have a development environment for JIRA plugins. The next step is to create a skeleton plugin, import it in to your IDE, and start writing some code! Creating the skeleton plugin, deploying it, and so on, is explained in detail in the forthcoming recipes of this chapter. So, ready, set, go…

There's more…

If you are facing issues while downloading the dependencies using Maven, just read on.

Proxy settings for Maven

If you are executing behind a firewall, make sure you have configured proxy settings in Maven's settings.xml file. A 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>

Note

To find out more about proxy settings for Maven and other aspects of it, go to 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 the M2_HOME environment variable to your local Maven, and update the respective settings.xml file with the repository details in the default settings.xml file that ships with the Atlassian plugin SDK. Or, you can simply add the following lines to the existing settings.xml file:

<pluginRepository>
  <id>atlassian-plugin-sdk</id>
  <url>file://${env.ATLAS_HOME}/repository</url>
  <releases>
    <enabled>true</enabled>
    <checksumPolicy>warn</checksumPolicy>
  </releases>
  <snapshots>
    <enabled>false</enabled>
  </snapshots>
</pluginRepository>

Configuring IDEs to use the SDK

If you are using IntelliJ IDEA, configuring it to use the SDK is an easy job because IDEA integrates Maven out of the box. Just load the project by selecting the pom.xml file! See https://developer.atlassian.com/display/DOCS/Configure+IDEA+to+use+the+SDK for more details.

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 https://developer.atlassian.com/display/DOCS/Set+Up+the+Eclipse+IDE+for+Linux for Linux, or https://developer.atlassian.com/display/DOCS/Set+Up+the+Eclipse+IDE+for+Windows for Windows.

If you are using Netbeans, check out https://developer.atlassian.com/display/DOCS/Configure+NetBeans+to+use+the+SDK on how to configure it to use the SDK.

Troubleshooting

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

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

  • Proxy configuration is done if required.

  • Antivirus in the local machine is disabled and/or firewall restrictions removed if none of the above works! Seriously, it makes a difference.

See also

  • The Creating a skeleton plugin recipe

lock icon The rest of the chapter is locked
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