Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

BitBucket scriptrunner create project

Alberto Medina December 3, 2019

Hi, 

 

   I am trying to create a new BitBucket project using scriptrunner. There seem to be a lack of examples on this and I am very confused by the documentation.

The idea is to have something working on the Script console that then I can use as a built it script.

I have tried using ProjectCreateRequest.Builder but in all honesty I cannot make sense of how to create an instance in order to pass it as a parameter to a ProjectService "create" method,  I am not able to pass the static type checking.

Does anyone have an example of give me some pointers on how this will work?

 

Thanks

1 answer

1 accepted

0 votes
Answer accepted
Robert Giddings [Adaptavist]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 5, 2019

Hi Alberto,

Please try the following script in the Script Console, which in this example creates a new project with the key "NEW" and name "New Project".

import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.bitbucket.project.ProjectService
import com.atlassian.bitbucket.project.ProjectCreateRequest

ProjectService projectService = ComponentLocator.getComponent(ProjectService)

projectService.create(new ProjectCreateRequest.Builder().key("NEW").name("New Project").build())

I hope this helps answer your question?

Robert Giddings

Alberto Medina December 5, 2019

Yes, it does, thanks you

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events