Groovy script for project and scheme creation - how to?

Hi Everyone,

we use a plenty of Jelly scipts for easy project, permission scheme and notification scheme creation. Hence Jelly is not supported anymore from the next JIRA version, we need to change to Groovy. The problem is that we don't know Groovy and therefore I ask you whether you have already such scripts or script skeleton?

It would be great help for us!

 

Thanks in advance,
Rumi

1 answer

1 accepted

basically it is not much different from java.
you inject JIRA components into the script and call their methods pretty much the same way you would do it in pure java. You can use ComponentManager or ComponentAccessor statically to inject JIRA components.

example creating a new project

import com.atlassian.jira.ComponentManager 
import com.atlassian.jira.project.ProjectManager

/* statically load project manager */
def projectManager = ComponentManager.getInstance().getProjectManager()

/* use project manager to create project */
projectManager.createProject(name,key,description,leadKey,url,assigneeType)

https://docs.atlassian.com/jira/latest/com/atlassian/jira/project/ProjectManager.html

Note: you may want to inject other JIRA components first to resolve parameters required to create desired projects and schemes. Follow JIRA docs.

Hi Alexej, thank you!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

172 views 1 17
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you