Atlassian Development : Sample code to get the list of projects from your JIRA instance..

In this blog post I will be sharing tips on how to populate a list of projects from your JIRA instance. The project list can be useful for features where you need to relate a particular issue to multiple projects or clone an issue under multiple projects.

select_projects

Getting the list of projects from JIRA database is a fairly straight forward task. Follow these steps to get the list:

 

  1. First import the required classes in your java file where you want to fetch all the current JIRA projects. Here are the commands for the importing files
  • import com.atlassian.jira.project.Project;
  • import com.atlassian.jira.component.ComponentAccessor;

 

  1. Now in the file, where you need to get the list of all current projects, write the following code
    • List projects=ComponentAccessor.getProjectManager().getProjectObjects();

Here the object projects is an Array List of type com.atlassian.jira.project.Project. You can get all the information of the projects from this ArrayList. Simple enough ?

 

 

Cheers

 

Profile photo of Rajeev Kumar

Rajeev Kumar

Rajeev has over 18 years of experience in IT managing large software development programs, organization change initiatives and Agile transformations. Prior to joining Mirketa Rajeev worked at startups and fortune 500 companies in senior management roles. He founded www.mytafi.in and www.finacast.com, personal finance management applications for Indian and US market. Rajeev is also the founder of www.wednik.com, a wedding planning application with online market for wedding planners and wedding merchandise.
Posted in Agile, AGILE Tools, JIRA. Tagged with , .

Leave a Reply

Your email address will not be published. Required fields are marked *


eight − 3 =

CommentLuv badge
Skip to toolbar