Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a new Jira project using script runner in Jira Data center version 9.12.22

Rutuja Sadul
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 2, 2025

I tried below code but getting below errors:

import com.atlassian.jira.bc.project.ProjectService
import com.atlassian.jira.bc.project.ProjectService.CreateProjectValidationResult
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.project.ProjectInputParameters

// Services and managers
def projectService = ComponentAccessor.getComponent(ProjectService)
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

// Define project details
def projectKey = "SAMP" // Must be unique
def projectName = "Sample Project"
def projectLead = "jiraadmin" // Username of the project lead
def projectTypeKey = "software" // e.g., software, business, service_desk
def projectTemplateKey = "com.pyxis.greenhopper.jira:basic-software-development-template"

// Create input parameters
ProjectInputParameters params = projectService.newProjectInputParameters()
params
.setKey(projectKey)
.setName(projectName)
.setLead(projectLead)
.setProjectTypeKey(projectTypeKey)
.setDescription("This project was created by ScriptRunner automation.")
.setAssigneeType(ProjectInputParameters.AssigneeType.PROJECT_LEAD)

// Validate
CreateProjectValidationResult validationResult = projectService.validateCreateProject(user, params)

if (validationResult.isValid()) {
def result = projectService.createProject(validationResult)
if (result.isValid()) {
return "✅ Project created successfully: ${result.project.key}"
} else {
return "❌ Failed: " + result.errorCollection
}
} else {
return "❌ Validation failed: " + validationResult.errorCollection
}

 

Errors are :The script could not be compiled: <pre>org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script57.groovy: 4: unable to resolve class com.atlassian.jira.project.ProjectInputParameters @ line 4, column 1. import com.atlassian.jira.project.ProjectInputParameters ^ 1 error </pre>.

Tried another script but still getting same error :

No signature of method: com.atlassian.jira.bc.project.DefaultProjectService.newProjectInputParameters() is applicable for argument types: () values: []

1 answer

0 votes
Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 2, 2025

Hi @Rutuja Sadul 

Welcome to the community.

Check this article from the scriptrunner documentation https://www.scriptrunnerhq.com/help/example-scripts/basics-create-project-onPrem 

Otherwise reach out to their support for further input and help.

Other solution is to use the API, see https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/project-createProject 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events