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

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 March 7, 2022

Thanks Neta

AUG Leaders

Atlassian Community Events