Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

can I get groovy script which is listing all components associated to a project?

Sasi P
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 29, 2018 edited

If the project key is known ,  I want to get  all the  components associated to this project using groovy.

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
2 votes
Answer accepted
Neta Elyakim
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 6, 2018

Just enter your project key instead of "EnterYourProjectKey".

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.project.component.ProjectComponent
import com.atlassian.jira.bc.project.component.ProjectComponentManager
import com.atlassian.jira.project.ProjectManager

def projectComponentManager = ComponentAccessor.getComponent(ProjectComponentManager)
def projectManager = ComponentAccessor.getComponent(ProjectManager)
def project = projectManager.getProjectByCurrentKey("EnterYourProjectKey")
long projectId = project.getId()
Collection<ProjectComponent> projectComponents = projectComponentManager.findAllForProject(projectId)
return projectComponents
Tomáš Vrabec _ServoData_ September 9, 2020

Thanks for this one!

Sayan Kaiser
Contributor
March 7, 2022

Thanks Neta

TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events