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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

1 answer

1 accepted

1 vote
Answer accepted

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Trello

🏊‍♀️ Atlympic Event: Trello

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

151 views 2 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you