import com.atlassian.jira.ComponentManagerimport com.atlassian.jira.component.ComponentAccessorimport org.apache.log4j.Categoryimport com.atlassian.jira.bc.project.ProjectService.DeleteProjectValidationResultimport com.atlassian.jira.bc.project.ProjectService.DeleteProjectResultimport com.atlassian.jira.bc.project.ProjectServicedef ComponentManager componentManager = ComponentManager.getInstance() def Category log = Category.getInstance("com.onresolve.jira.groovy") def projectManager = ComponentManager.getInstance().getProjectManager() def projectService = ComponentManager.getComponentInstanceOfType(ProjectService.class) def user = componentManager.jiraAuthenticationContext?.user def projectsList = projectManager.getProjectsFromProjectCategory(projectManager.getProjectCategoryObjectByNameIgnoreCase("No Category")) for(p in projectsList) { try { def projectKey = p.key; final ProjectService.DeleteProjectValidationResult result = projectService.validateDeleteProject(user, projectKey); final ProjectService.DeleteProjectResult projectResult = projectService.deleteProject(user, result); if (projectResult.isValid()) { log.info(" project " + projectKey + " correcty deleted"); } else { log.error("projet " + projectKey + " wrongly deleted " + projectResult.getErrorCollection().getErrors()); } //break } catch (Exception e) { log.error("Exception with project "+ p.key + "\n"+ e); break } }
I don't see any logs writing. Is thre some thing wrong here for deleting projects from Script console?
Want to make your everyday Community actions directly contribute to reforestation? The Atlassian Community can achieve this goal by liking a post, attending an ACE, sending your peers kudos, and so much more!
Help us plant more trees
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.