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?
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.