Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
JIRA Development Cookbook

You're reading from   JIRA Development Cookbook Third Edition

Arrow left icon
Product type Paperback
Published in Sep 2016
Publisher
ISBN-13 9781785885617
Length 598 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface 1. Plugin Development Process FREE CHAPTER 2. Understanding the 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 the JIRA Database 11. Useful Recipes

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 preconfigured settings.xml 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 on JIRA.

Getting ready

The following are the prerequisites for running the Atlassian Plugin SDK:

Note

At the time of writing this recipe, the latest version of the Atlassian Plugin SDK is 6.1.0.

  • The default port for the SDK, 2990,should be available. This is important because different ports are reserved for different Atlassian products.
  • Install JDK. Java version 1.8.X is required for Atlassian Plugin SDK 6.1.0. Please verify the compatible Java version for your SDK version.
  • Make sure the JAVA_HOME is set properly and the command java -version outputs the correct Java version 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://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project.
  2. Unzip the version into a directory of your choice or follow the instructions on the page, depending up on the operating system. Let's call this directory SDK_HOME going forward.
  3. Add the SDK's bin directory into the environment PATH variable. If you are using the installer, this step is automatically done.
  4. Create a new environment variable, M2_HOME, pointing to the apache-maven directory in your SDK Home. SDK version 4.x+ handles this step automatically.
  5. Install the IDE of your choice. Atlassian recommends Eclipse, IntelliJ IDEA, or NetBeans, as they all support Maven.
  6. Ready, set, go...

There's more...

With the preceding steps executed properly, we have a development environment for JIRA plugins. You can verify the installation of the SDK by running the following command:

atlas-version

This command displays the version and runtime information of the installed SDK.

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.

If you face issues while downloading the dependencies using Maven, read on.

Proxy settings for Maven

If you are behind a firewall, make sure you configure proxy in the Maven settings.xml file. 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 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 the M2_HOME directory to your local Maven and update the respective settings.xml with the repository details in the default settings.xml that ships with the Atlassian Plugin SDK.

Or you can simply add the following to the existing settings.xml:

<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, it is an easy job because IDEA integrates Maven out of the box. Just load the project by selecting the pom.xml! See https://developer.atlassian.com/docs/developer-tools/working-in-an-ide/configure-idea-to-use-the-sdk for 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/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/set-up-the-eclipse-ide-for-linux or https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/set-up-the-eclipse-ide-for-windows, depending on the OS.

For NetBeans, see https://developer.atlassian.com/docs/developer-tools/working-in-an-ide/configure-netbeans-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 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 and/or firewall restrictions removed if none of the above works! Seriously, it makes a difference.
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
JIRA Development Cookbook
You have been reading a chapter from
JIRA Development Cookbook - Third Edition
Published in: Sep 2016
Publisher:
ISBN-13: 9781785885617
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 €18.99/month. Cancel anytime
Modal Close icon
Modal Close icon