Copy Versions from one Project to Another


Bulk copy all versions from a source project to a destination project.


As a project manager, I want to apply the same versions to different projects. I can copy all versions existing in a source project to a destination project.

Good to Know

  • Versions with the same name should not already exist in the destination project.
  • You can fine-tune the versions and data to copy based on specific logic. Check the versions properties at the REST API documentation.


Jira Jira

// Specify the master project to get the versions form final sourceProjectKey = "SRC" // Specify the key of the project to copy the version to final destinationProjectKey = "DST" // Get the project versions def versions = get("/rest/api/2/project/${sourceProjectKey}/versions") .header('Content-Type', 'application/json') .asObject(List).body as List // Loop over each version returned and create a version in the new project def successStatusByVersionId = versions.collectEntries { version -> // Copy the version and specify the destination project def versionCopy = version.subMap(['name', 'description', 'archived', 'released', 'startDate', 'releaseDate', 'project']) versionCopy.project = destinationProjectKey // Make the rest call to create the version"Copying the version with id '${}' and name '${}'") def createdVersionResponse = post("/rest/api/2/version") .header("Content-Type", "application/json") .body(versionCopy) .asObject(Map) // Log out the versions copied or which failed to be copied if (createdVersionResponse.status == 201) {"Version with id '${}' and name '${}' copied. New id: ${}") } else { logger.warn("Failed to copy version with id '${}' and name '${}'. ${createdVersionResponse.status}: ${createdVersionResponse.body}") } [( (createdVersionResponse.status == 201)] } "Status by source version id (copied?): ${successStatusByVersionId}"
Discovered an issue? Report it here

Suggested for you