We are in “migrations” times, and this script probably will be useful to “repeat” failed “Project Importations” in Jira Server & Datacenter. To reset Versions & Components in a target project we can use a script in Groovy for Scriptrunner in order to run it in the Script Console.

IMPORTANT: Remember to change the Key of the project in the script!

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.version.VersionManager

VersionManager versionManager = ComponentAccessor.getVersionManager()
def project = ComponentAccessor.projectManager.getProjectObjByKey("KEY_OF_PROJECT");
versionManager.deleteAllVersions(project.getId())
 
ComponentAccessor.projectComponentManager.deleteAllComponents(project.getId())

By MrAddon

.

Posted by:.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s